I already asked this question a few days ago on the Django mailing list, but got no replies unfortunately.So here i go again:
On Django 1.2.3 i am trying to get a dynamic form working. On the first page a user have to give their address/client id and on the second page customers can order dishes for catering.
To dynamically add forms on the second page i use http://code.google.com/p/django-dynamic-formset/
Here is my models.py:
class Catering(models.Model):
customer_id = models.CharField(max_length=20)
company = models.CharField(max_length=40)
class DishesForm(forms.Form):
gerecht = fields.CharField(max_length=200)
aantal = fields.IntegerField(required=False)
DishesFormset = formsets.formset_factory(DishesForm)
class TestWizard(FormWizard):
def done(self, request, form_list):
return render_to_response('testwizard', {
'form_data': [form.cleaned_data for form in form_list],
})
urls.py:
(r'^testwizard/$', TestWizard([CateringForm, DishesFormset])),
The problem i have is that in the template I can only call the
complete form with {{form}}
. In order to get the javascript working
properly I need to call the fields seperately like
<td>{{form.gerecht}}
</td>
When i test the dynamic form (DishesFormset) seperately without the formwizard everything works fine.
How do i call the seperate formfields within the formwizard?