Re: acces cleaned data from a dynamic form
Thank you for your help!
> I don't understand your questions.
I am sorry about that, I probably ask my question the wrong way
because of my lack of experience
> A formset is a set of forms. What would {{ formset.dish }} even refer to?
> Only the forms inside the formset have a `dish` field.
When I try {% for form in formset %}{{form.dish}}
I get a "non iterable" error
In order to style the form right I need to call the seperate
formfields.
>
> Question 2 is impossible to answer without seeing your view code.
> --
> DR.
My views.py is very basic so not much to show (see below). When I view
the POST info all information is posted right. One address, Dish1,
Dish2 The only thing i want is validate the form and show/mail the
results. When i try "for form in formset.cleaned_data" i get that "non
iterable" error again.
Till now i only managed to validate and show Dish1. I probably oversee
something very basic.
def testform(request):
if request.method == 'POST':
form = AddressForm(request.POST)
formset = DishesFormset(request.POST)
if formset.is_valid():
return render_to_response('test', {
'form_data': formset.cleaned_data,
})
else:
form = AddressForm()
formset = DishesFormset()
return render_to_response('testform', {
'form': form,
'formset': formset,
}, context_instance = RequestContext(request))
--
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