Tagged Questions
0
votes
1answer
12 views
django implementing simple vistor log
I'm fair new to Django and I am trying to log visitor for my blog. I'm using generic view for my blog and here is part of code:
#blog/urls.py
urlpatterns = patterns('',
#index
...
0
votes
1answer
19 views
Dynamically add to Django Model
I have need to dynamically (not manually edit models.py) alter/add/remove from a Django Model. Is this possible? Once the model is altered, will it persist? I then want to use South for running the ...
0
votes
0answers
20 views
django change foreignkey Field
this is my models.py
class Equipment(models.Model):#table
equipment_Number = models.CharField(max_length=50,default=0,unique=True) #column
equipment_Name = models.CharField(blank=True, ...
0
votes
0answers
5 views
what content should I add in pjax_base.html while using django easy pjax
I am using django-easy-pjax for making a Single-Page-Application:
base.html:
{% load staticfiles %}
<script type="text/javascript" src="{% static '/static/js/jquery.js' %}"></script>
...
0
votes
0answers
15 views
django nonrel ImportError when running a script
I've configurated a virtual environment for my project, all is working except that when I try to run a script to populate the MongoDB data base. I get a ImportError exception.
I am using django ...
0
votes
1answer
6 views
When should a Django logging instance be created?
Should a logging instance whose runtime configuration will never be altered be created (via getLogger) inside of each function that uses it, or can I create it once and only once outside of the ...
0
votes
2answers
22 views
Why does my Ajax call have an empty POST?
When I submit an Ajax request to save a form, I get an empty request.POST QueryDict. Hopefully I'm just overlooking something due to inexperience with Ajax. Here is the relevant code:
Ajax
...
0
votes
2answers
16 views
Multiple search criteria django form
Im following the Django docs in order to build a multiple search criteria form. My first question is if this should be the correct method of filtering values in the query and also how can i add the ...
0
votes
0answers
6 views
Django haystack bad request 400 on production
I'm stuck with this bad request 400 issue when I query for an object that exists in the database.
I don't think it has anything to do with the ALLOWED_HOSTS settings because the search in my other ...
0
votes
0answers
19 views
Change Django Radio input into toggle button using bootstrap switch or similar
models.py
class Listener(models.Model):
# other columns
availability = models.BooleanField(default=False)
Initially I was planning on creating a AvailabilityForm object and take the input ...
0
votes
1answer
19 views
Sending mail in Django 1.5 with Gmail smtp
I try to send mail with Gmail smtp in my Django App.
I followed some instructions to configure my setting.py file.
Here is my code snippet in setting.py file.
EMAIL_BACKEND = ...
0
votes
0answers
10 views
Django/MongoEngine: Proper way to use foreign keys/embedded documents?
Right now I'm just using something similar to
class x(models.Model):
foreignkey = models.ForeignKey(y)
but when I try to add an instance to it like
instance_of_y = ...
0
votes
2answers
30 views
Extra fields in Django ModelForms: I can see them, but cannot save them to the model. Why?
In my Django application, I am using a ModelForm to get my user to enter a street address.
I want clean this address, perform USPS validation on it, then geocode it. If all those steps succeed, I ...
0
votes
0answers
19 views
Spotify web API gives 500 errors often
I am building an app that interfaces with the spotify web API using the python package 'spotipy'.
However, I randomly will get 500 errors like so:
http status: 500, code:-1 - the requested resource ...
0
votes
0answers
12 views
Django Wizard don't save variable in sessions when go back
I created a wizard form in django with 8 steps and for each step I do:
def process_step(self, form):
if self.steps.current == 'step1':
...
self.request.session['arrangement'] ...
1
vote
1answer
23 views
Django Templates: Use different css for pages
New to Django, I want to use different css files for different pages - i.e. page1.css for page1.html, page2.css for page2.html. Is there a way to do this while still extending base.html?
In base.html
...
1
vote
1answer
30 views
Whats the difference between a OneToOne, ManyToMany, and a ForeignKey Field in Django?
I'm having a little difficult getting my head around relationships in Django models.
Could someone explain the difference is between a OneToOne, ManyToMany and ForeignKey?
0
votes
0answers
12 views
Using etcd to manage Django settings
Let's say that I have a Django app, and I've offloaded environment variable storage to etcd. When I deploy a new server, the app can read from etcd, write the vars into (for example) a Python file ...
0
votes
0answers
9 views
Django smart_selects not working
I used django smart selects but it didn't work
class Constructeur(models.Model):
idconstructeur = models.AutoField(primary_key=True)
nom = ...
2
votes
0answers
24 views
How does a generic Python library manage settings?
I have an existing Django app. Part of it is specific to a Django web app of ours, but another part does a lot of complicated computation, and it may be useful to more of our products. I am busy ...
2
votes
0answers
18 views
Monkey patching in django settings
I'm trying to do something that should be simple, which is to test Django settings given different OS environment set.
I'm using the Mock library from http://www.voidspace.org.uk/python/mock/
And ...
0
votes
1answer
45 views
how to call a function inside a django html template
I m new to Django. The question is rather basic manner but I tried some google and documents, apparently can't resolve it.
Basically:
I need to access the blog entries of a particular blog inside ...
-3
votes
0answers
27 views
what is Central Server [on hold]
Hi I need some information about the Central Server and I want that Central Server will behave as a Certification Authority and generate certificates
but I could not find information on the internet
...
1
vote
1answer
15 views
Multiselect dropdown/list in django admin panel only
django model choice option as a multi select box
Django Multiple Choice Field / Checkbox Select Multiple
Django: How can i create a multiple select form?
I'm trying to add a multiselect field in ...
0
votes
1answer
25 views
How to create a ListView with an argument | Django 1.6?
I'm using Django 1.6 with python v.2.7.1
I have a model Category (id,title,slug) and Films that belong to a category.
I want simply to create a generic ListView to see all the films in one category.
...
0
votes
1answer
20 views
Django: Accessing HttpRequest in Class Based Generic View ListView
I'll be implementing a customized class based generic view by sub-classing ListView in my views.py. My question is how will be able to access the request (HttpRequest object) parameter in my ...
0
votes
1answer
24 views
Django 1.6: Login redirection button not working on Firefox and Safari
I have this in my template to allow people to post reviews. If the user is not logged in it takes him to the login page when clicked on the write review button, and then redirect backs to the same ...
0
votes
1answer
18 views
Can't run syncdb on Google CloudSQL OperationalError 1045 Access denied for user 'root'@'localhost' using password: NO
Based on the following google documentation and tutorials I have the following setup.
I have never had google prompt me for the oauth token url. As it should per their documentation. I am not sure ...
2
votes
0answers
21 views
django autofield, inheritance, manytomanyfield and … no save
I've a Class with a ManyToManyField and a SubClass with an AutoField subID. Django saves the ManyToManyField instances with the value of the subID and not, as one would expect with the value of the ...
1
vote
0answers
13 views
Django FileBrowser 400 Error
I'm getting a 400 error when trying to access the /admin/filebrowser/browse/ page. I followed the instructions as per https://django-filebrowser.readthedocs.org/en/3.5.2/quickstart.html and have my ...
1
vote
0answers
25 views
django custom 404 not working..context variable not showing
I use django 1.6
In myapp1/urls.py
from django.conf.urls import patterns, include, url, handler404
# url patterns...
#
#
handler404 = 'myapp1.views.custom_page_not_found'
...
0
votes
1answer
39 views
I get error when I want to insert data to classes of model in django?
I learning django and I'm reading "https://docs.djangoproject.com" and try to do their example for myself.
My project name is "student" and wrote two class in student's models,mysite/student/models:
...
1
vote
0answers
10 views
Extending the django admin log causing unknown column in where clause
I've got a requirement to store an audit log of various actions on a django site so I've extended the standard log model to accommodate the extra information we need to store.
models.py;
from ...
0
votes
0answers
13 views
Add fields dynamically based on some other field in Django model
I have a model
class MyModel(models.Model):
field1 = Charfield
field2 = Integerfield
# some more fields
so based on field2 (a integer field) I want to add some more fields.
for example ...
0
votes
0answers
13 views
mezzanine how to use different template?
How to use "@processor_for" ?
it is not work!, this use template of "page". I want to use a different Tmplate.
thank you!
models.py
class RichGallery(Page):
class Meta:
verbose_name = ...
0
votes
1answer
15 views
python template syntax in edx-platform
I'm studying lms service that edx-platform.
It's using the python 2.7 + django.
In general, the use python template syntax is as follows:
{% extends "base_generic.html" %}
{% block title %}{{ ...
0
votes
1answer
18 views
Using python sessions to pass variable from one function to another function
I have a couple of quick questions -
~* when I used to code in Java, we used to reduce the usage of session variables as it used to slow the engine/occupy quite some space. In Python-django when I was ...
0
votes
1answer
18 views
Django-SEO giving error
I am trying to implement meta tags in an existing Django app. For this, am using Redsolution Django-SEO
As they showed in the readme, my setup and migrations are all fine. Even the fields are ...
1
vote
1answer
24 views
Send Custom message in Django PermissionDenied
I am using django's PermissionDenied to render 403.html whenever the user is not allowed to access any page.
There are whole lot of pages, of different type, for example, Product page, User Page, ...
0
votes
1answer
4 views
Aptana Studio 3 newproject error with Django
I am having an issue with starting a new project from the command prompt. After I have created a virtual env and activated the enviroment, when I enter in .\Scripts\django-admin.py startproject ...
1
vote
0answers
16 views
LiveServerTestCase server sees different database to tests
I have some code (a celery task) which makes a call via urllib to a Django view. The code for the task and the view are both part of the same Django project.
I'm testing the task, and need it to be ...
1
vote
1answer
17 views
Django Rest Framework - Missing Static Directory
I have recently started a Digital Ocean server with a pre-installed Django image on Ubuntu 14.04. I wanted to create an API, and have decided on the Django Rest Framework. I installed the Django Rest ...
1
vote
1answer
10 views
Pagination class based views django 1.5
I'm developing a website based on Django==1.5.7
I need to paginate the ListView of a table in my application.
This is the code i'm using
On models.py:
class UsuarioFidetel(models.Model):
"""
...
0
votes
0answers
8 views
Serve an OpenCV dynamically generated image with Django
I'm trying to get Django to load a JPG as a numpy array in my views.py so I can run it through some processing and display the result.
The following code works, but I'm wondering if it's the most ...
0
votes
2answers
33 views
Can I pass URL parameter into a get request in django?
I'm passing a slug in the url like this:
url(r'^fragen/(?P<slug>[-_\w]+)/beantworten/$', qna_answer_add,
name="qna_answer_add"),
Can I use the slug like this:
qna_answer_model.question = ...
-2
votes
1answer
23 views
ImportError, cannot import name 'Col' [on hold]
I just installed Django on Python 3.4. Commands I used were pip install django and then I ran django-admin startproject mysite and then just 'cd-ied' to the dir and ran python manage.py runserver
...
0
votes
1answer
27 views
Deploying Django with Virtualenv and Apache
I would like to deploy a site that was created with Django. The production environment is a rented virtual server.
I would like to deploy the application with Django. Therefore, I changed all ...
0
votes
0answers
17 views
Can't get user data for Google using python-social-auth
I have successfully configured the project
urls.py
url('', include('social.apps.django_app.urls', namespace='social'))
And I have also hooked the right redirect URI's in my Google app. This is the ...
0
votes
2answers
17 views
Python mock to create a fake object returns dictionary when any of it's attribute is used
for example I have a method in Django which reuses the request object:
def dowork(request):
# the sessionid is a query param of the callback from payment gateway
print ...
0
votes
1answer
12 views
Model redundant django tables?
I am working to figure out the model for a Django project: an app to track Books.
Among other fields, every Book has either/both a Printer and a Publisher, which are basically identical. So, here's ...