DocumentFormSet = modelformset_factory(Document, extra=0,
fields=('name', 'category')
with a models.py like this:
class Category(models.Model):
name = CharField(max_length=100)
# other stuff
class Document(models.Model):
name = CharField(max_length=100)
category = ForeignKey(Category)
# other stuff
When the DocumentFormSet renders, category appears as a select widget.
I have a variable in my request session that I would like to use to
set the initial value of the category widget.
What would be the best way to go about this? Is it necessary to create
a custom widget to achieve this?
--
steve
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment