acces cleaned data from a dynamic form
Django 1.2.3
For a restaurant i want to make a form, were the user can add their
address, and their order. The order part is dynamic (users can add
extra fields). I used jquery.formset for this.
To accomplish this i have an address form and a dishes formset:
class Address(models.Model):
name = models.CharField(max_length=20)
class AddressForm(ModelForm):
class Meta:
model = Address
class DishesForm(forms.Form):
dish = forms.CharField(max_length=200)
DishesFormset = formsets.formset_factory(DishesForm)
In the view i call these forms with: form = AddressForm() formset =
DishesFormset()
I have two problems with the formset:
1. in the template i can only get a form with {{formset}} .
{{formset.dish}} doesn't work
2. how do i access the cleaned_data from the formset? When I test I
see in the POST that multiple dishes are posted, but I can only get
the first one in the cleaned_data
Rob
--
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home