Tagged Questions
1
vote
0answers
8 views
How do you correctly express a nested relation for django-rest-framework?
Class B:
ForeignKey(A, related_name='b_set')
Class A:
stuff
SerializerB:
other stuff
class Meta:
model = B
SerializerA:
Bs = SerializerB(many=True, required=False)
...
0
votes
1answer
13 views
HttpResponseRedirect url reset
Guys this is simple I'm using HttpResponseRedirect when updating an item in the CRUD,
return HttpResponseRedirect('catalog/'+category.slugc+'/product/')
the url I'm getting is: ...
0
votes
1answer
18 views
get_success_url produce “None” at the end of URL
I have been trying to use "UpdateView" in django generic views. What I am trying to achieve is to return to the same "UpdateView" page.
My codes are as follows:
My urls
#urls.py
urlpatterns = ...
0
votes
0answers
13 views
How can I write session variable from model/table in Django?
I am trying to assign a session variable based on a model or database table on my Django site. In other words, on the first use, I want the user to select a county from a dropdown list and write the ...
0
votes
0answers
14 views
MySQL tables disapeared and Django returns strange errors on syncdb/cleanup
I'm using virtualenvwrapper, something went wrong so I had to delete the virtualenv, recreate it and reinstall the modules.
Anyway everytime I try to run syncdb, I get the following error:
...
0
votes
0answers
26 views
Django NoReverseMatch u'"proto' is not a registered namespace
Django 1.6.1
Python 2.7.5
ISP webfaction
After upgrading to django 1.6.1, I get the following error on the root /.
NoReverseMatch at /proto/
u'"proto' is not a registered namespace
My urls.py is ...
0
votes
2answers
20 views
Setting values to a form in django
can anyone help me, I'm making a CRUD in django and I want to set the form fields of the Edit section with the actual data of the item that I'm selecting. Can anyone tell me how can I do this.
...
0
votes
2answers
22 views
Problems with Django and Parsing a json
I am trying to take a posted json, and import the object into the django database.
The Json looks like:
{
"pooledSets" : [
{
"name" : "Pooled Set 1",
"madeBy" : "John Doe",
...
0
votes
0answers
28 views
getting error 'WSGIRequest' object has no attribute 'user'
I am using my custom middleware:
class CheckWebsiteExistsMiddleware(object):
def process_response(self, request, response):
if request.user.is_authenticated() and not request.user.website:
...
-1
votes
1answer
49 views
fetchall for loop multiple list to one
I have followings in my django:
My models.py
import datetime
from datetime import datetime, date, timedelta
import dateutil
from dateutil.relativedelta import relativedelta
from dateutil.rrule ...
0
votes
1answer
27 views
Named url with kwargs issue
Can anyone explain to me what is happening here? In the same template I have the following:
<a href="{% url 'triage' group_id=group.id as group_url %}{{ group_url }}">Group</a>
<a ...
0
votes
0answers
22 views
Bulk enabling Django model field names for translation
Is there a way to efficiently include all model field names for translation without manually specifying a verbose_name for all of them?
I'm trying to add translation support to a legacy Django app, ...
0
votes
1answer
50 views
for loop in function
My python knowledge is still limited, I don’t know how to execute this function and class in django.
Later instead of print I will make four query loop to raw database, could someone help me to do ...
0
votes
1answer
13 views
Django App Error “DatabaseWrapper objects created in a thread” all of a sudden
refreshed the tab in my browser for my django app and got:
DatabaseWrapper objects created in a thread can only be used in that same thread
it appears its happening on: if form.is_valid(): within:
...
2
votes
2answers
42 views
What is the best way to add logging for creation of a Django Model instance?
Suppose I have the models defined in my Django models.py file as shown below.
I would like to add some generic code such that every time any instances of modelA or modelB are created, a log message ...
0
votes
1answer
61 views
What is the python regex to match everything?
So I have a django site with only 1 app, but I want to maintain the suggested folder structure so I want all incoming requests to the root url conf to go to that 1 app's urls.py
Essentially I have a ...
0
votes
0answers
16 views
Mezzanine - Adding Forms
I get this ValueError when trying to add a form to my recently installed Mezzanine CMS. I am using Django 1.5 and the latest download available from Mezzanine. I'm not really sure what to do from ...
0
votes
0answers
20 views
Django using unique_together in a subclass of custom user model
I extended Django's user class by extending the abstract first:
class XUserAbstract(AbstractBaseUser, PermissionsMixin):
email = models.EmailField(
db_index=True,
...
-2
votes
3answers
24 views
Conditions Invalid block tag: 'else', expected 'endblock' Django
{% if not User_Tld_Entered %}
#HTML HERE
{% endif %}
{% if User_No_Auth_Tld > 0 %}
{% for NotAuthDomain in User_No_Auth_Tld %}
#HTML HERE
{% endfor %}
{% ...
0
votes
1answer
31 views
UnicodeEncodeError when printing from Django
Using python interpreter
>>> print u'\xe9'
é
But if I put the same line inside a Django view, I get
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 0:
...
2
votes
1answer
26 views
Output utf-8 characters in django as json
I am trying to output some json with cyrillic characters in it.
But, for instance, instead of cyrillic A I get it's ascii code - \u0410
And it is not json encoder that breaks the stuff. If I try to ...
0
votes
0answers
20 views
Django: same filesystem based caching works in Windows, not in Linux
I'm willing to cache most of the processing results for the site homepage, namely a data dict summarizing numbers of database objects (resources per category).
Tried filesystem cache at low level ...
0
votes
1answer
20 views
PIL ImageDraw.Draw.text fill attribute raise TypeError : an integer is required
I'm trying to write text on an image of a QR-Code, but I can't find a way to write in another colour than white (which is pretty useless for a QR-Code).
So here is the error page I get (I'm using ...
0
votes
1answer
29 views
Undefined variable on get_or_create in django?
I have a many-to-many relationship between a link and a term in Django, but when trying to check if the relationship already exists between the link and term I'm getting an undefined variable on the ...
0
votes
3answers
41 views
Django urlpattern “didn't match”
I have the following code in my urls.py:
urlpatterns = patterns('',
(r'^news/', include('news.urls')),
)
When I try to open
http://localhost/news
or
http://localhost/news/
in the ...
-1
votes
1answer
42 views
Which data architecture fits our requirements? [on hold]
We have a back office system to manage our resources, and over the time it has grows to the point that every relevant data is placed in the same database.
Now we are creating other solutions that will ...
0
votes
1answer
17 views
constantLine function not working in graphite (0.9.12) and django 1.6.1
I am currently using graphite 0.9.12 with django 1.6.1 , I am able to acquire the stored metrics both is json and image formats. However when i try the constantLine function in json format, i get the ...
0
votes
0answers
12 views
Using django-publications and django-userena together
How can i make retationship between publication and user account. I thought about some "authortags" , but when we are creating publication we can add author in various way. Maybe i should modify model ...
4
votes
5answers
127 views
Python - how to speed up calculation of distances between cities
I have 55249 cities in my database. Every single one has got latitude longitude values.
For every city I want to calculate distances to every other city and store those that are no further than 30km. ...
-1
votes
1answer
28 views
“name error: name 'admin' is not defined” error while trying to alter admin form for django
Guys I am following "https://docs.djangoproject.com/en/1.5/intro/tutorial02/" tutorial and I successfully created models and displayed. But when I am trying to alter admin form its giving me error ...
-3
votes
1answer
41 views
how to configure url for specific method written in view in django [on hold]
First of all I am a newbie in python, following tutorials on the internet.
I have python and django configured in eclipse
I am facing problem of calling method defined inside view.
give me a simple ...
1
vote
1answer
40 views
How do I pass custom variable values to the django admin interface?
I want to do something very simple but I couldn't find any information anywhere: I want to pass some variables to the admin interface of django. In simple words, I want to calculate some values:
def ...
1
vote
2answers
28 views
Django 1.5.4 Python Count a Loop
I'm trying to get the amount of times these loops have gone into a variable. (I know they're static right now, but eventually they'll be based of data coming from other places).
I know how to do it ...
0
votes
0answers
11 views
Add eternicode datepicker calendar icon to my django form
I am attempting to install eternicode datepicker to my django 1.4 project.
But I cannot add the component date calendar icon.
My issue is concerning of how to add the followng code to my django ...
0
votes
0answers
10 views
Azure website use python3 with django
Officially, Azure Django Websites only support Python 2.7 and Django 1.4, but I am wondering if it is possible to set up an Azure Django website using Python 3.3 and Django 1.6 instead. This official ...
2
votes
1answer
29 views
Is using django auth Group the right way to solve this?
A little background: I am building a discussion board app aimed at educators. It's essentially a reddit-style discussion board where responses to a prompt are 'up-voted' or 'down-voted'. The content ...
0
votes
0answers
24 views
cant create truly asynchronous child process in django
So I have a view that I can send an Http post or get. The post handler is set up to asynchronously create a child process, then return a string. The problem is that it seems to create the process, ...
2
votes
1answer
41 views
Django templates {% if %}: what does it take to be equal?
Here's a chunk of code from a Django template:
{% for customer in customers %}
{% for div in divs|lookup:customer %}
<p>:{{ div.custdiv_id }}: vs. :{{ currentDiv }}: ==>
...
1
vote
1answer
20 views
How to structure backend of a fantasy sports analytics website on Django?
I'm looking to make an analytics fantasy sports site and I need a little help thinking how to structure the site as a whole. It's most definitely been done before but I'm doing this for educational ...
0
votes
2answers
42 views
Where is account creation a solved issue in Django?
I am working on account management for a Django site.
I wish to have a system that prompts people to fill out a form, specifying an email address and password (but no CAPTCHA), the system sends an ...
0
votes
2answers
57 views
Struggling with django hierarchy - not serving admin css
I'm trying to work through the django tutorial but have gotten hung up on displaying the css associated with the admin module. I'm working on windows, with django 1.6, apache and MySQL
My current ...
1
vote
2answers
39 views
Django URLs NoReverseMatch
I've been trying to figure this out, but can't seem to catch my error.
In my Django 1.6 project I have two apps: hold and control
Project urls.py
url(r'^control/$', include('control.urls')),
App ...
0
votes
1answer
45 views
Django Permissions for Different Clients
I'm working on a Django project which will take on firms as clients and each client will be allowed to create multiple users. These users can then be assigned different permissions or roles.
The ...
0
votes
1answer
28 views
Django is_ajax history back
I wrote a Django view that responses ether a text/html or a application/json depending on request.is_ajax().
So far so good, but when I use my browsers history buttons, I end up getting a JSON ...
1
vote
2answers
40 views
Run Unittest On Main Django Database
I'm looking for a way to run a full celery setup during django tests, asked in this other SO question
After thinking about it, I think I could settle for running a unittest (it's more of an ...
0
votes
1answer
34 views
http response status 405 METHOD NOT ALLOWED when using jquery submit
I try to use the jquery-ui dialog widget which execute the submit for the update, but the http response status is 405 METHOD NOT ALLOWED.
Is there lacking in my implementation?
Forms
...
0
votes
1answer
16 views
No module named menus.menu_pool
Installing Django-CMS and I get the following error when trying to runserver:
File "test/cms/models/pagemodel.py", line 27, in <module>
from cms.menus.menu_pool import menu_pool
...
3
votes
0answers
34 views
Run a Celery worker that connects to the Django Test DB
BACKGROUND: I'm working on a project that uses Celery to schedule tasks that will run at a certain time in the future. These tasks push the state of the Final State Machine forward. Here's an example:
...
1
vote
1answer
41 views
Managing multiple user base in same database table
There is a Django project that my team is working on. It will have an administration panel to control several companies under it. To add a new company into the system, the admin will add the domain of ...
1
vote
2answers
39 views
Django: How to ensure correct encoding of input sent via a form
I'm running into an issue with Unicode input on a form with Django:
UnicodeEncodeError at /
'ascii' codec can't encode character u'\xe4' in position 7: ordinal not in range(128)
This happens with ...