On Sunday, 24 June 2012 15:36:27 UTC+1, het.oosten wrote:
>
> 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


I don't understand your questions.

A formset is a set of forms. What would {{ formset.dish }} even refer to? 
Only the forms inside the formset have a `dish` field.

Question 2 is impossible to answer without seeing your view code. 
--
DR.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/JgpB81vHKwoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to