105
votes
14answers
23k views
Dynamically adding a form to a Django formset with Ajax
I'd like to be able to automatically add new forms to a Django formset with an ajax function. I.e., the user clicks an "add" button and some javascript will add a new form (which is part of the ...
320
votes
23answers
48k views
Does Django Scale?
I'm building a web application with Django. The reasons I chose Django were:
I wanted to work with free/open-source tools
I like Python and feel it's a "long term" language, whereas regarding Ruby I ...
111
votes
9answers
47k views
Extending the User model with custom fields in Django
What's the best way to extend the User model (bundled with Django's authentication app) with custom fields? I would also possibly like to use the email as the username (for authentication purposes).
...
67
votes
8answers
27k views
Having Django serve downloadable files
I want users on the site to be able to download files whose paths are obscured so they cannot be directly downloaded.
For instance, I'd like the URL to be something like this, ...
174
votes
5answers
172k views
Converting string into datetime
Short and simple. I've got a huge list of date-times like this as strings:
Jun 1 2005 1:33PM
Aug 28 1999 12:00AM
I'm going to be shoving these back into proper datetime fields in a database so I ...
30
votes
9answers
55k views
How to add to the pythonpath in windows 7?
I have a directory which hosts all my django app here:
"C:\My_Projects".
I want to add this directory to my pythonpath so I can call the apps directly.
I have right clicked My Computer > ...
35
votes
8answers
8k views
How do I access the child classes of an object in django without knowing the name of the child class?
In Django, when you have a parent class and multiple child classes that inherit from it you would normally access a child through parentclass.childclass1_set or parentclass.childclass2_set, but what ...
60
votes
7answers
15k views
Django Passing Custom Form Parameters to Formset
I have a Django Form that looks like this:
class ServiceForm(forms.Form):
option = forms.ModelChoiceField(queryset=ServiceOption.objects.none())
rate = ...
41
votes
3answers
9k views
Django dynamic model fields
I'm working on a multi-tenanted application in which some users can define their own data fields (via the admin) to collect additional data in forms and report on the data. The latter bit makes ...
96
votes
12answers
53k views
Using Django time/date widgets in custom form
How can I use the nifty JavaScript date and time widgets that the default admin uses with my custom view?
I have looked through the Django forms documentation, and it briefly mentions ...
121
votes
16answers
26k views
Django - Set Up A Scheduled Job?
I've been working on a web app using Django, and I'm curious if there is a way to schedule a job to run periodically.
Basically I just want to run through the database and make some ...
75
votes
6answers
36k views
How do I filter ForeignKey choices in a Django ModelForm?
Say I have the following in my models.py:
class Company(models.Model):
name = ...
class Rate(models.Model):
company = models.ForeignKey(Company)
name = ...
class Client(models.Model):
...
75
votes
9answers
35k views
Programmatically saving image to Django ImageField
Ok, I've tried about near everything and I cannot get this to work.
I have a Django model with an ImageField on it
I have code that downloads an image via HTTP (tested and works)
The image is saved ...
50
votes
4answers
42k views
Django equivalent for count and group by
I have a model that looks like this:
class Category(models.Model):
name = models.CharField(max_length=60)
class Item(models.Model):
name = models.CharField(max_length=60)
category = ...
27
votes
2answers
11k views
How to stream an HttpResponse with Django
I'm trying to get the 'hello world' of streaming responses working for Django (1.2). I figured out how to use a generator and the yield function. But the response still not streaming. I suspect ...