0

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?

het.oosten
  • 885
  • 7
  • 21
  • I saw that lots will change in formwizard in future releases of Django, and i could not get this working. Therefore i switched to Jquery formwizard http://thecodemine.org/ This plugin makes it possible to show parts of forms on different pages (and do some server side validation when switching between two pages) – het.oosten Jun 24 '12 at 12:47
  • In case anybody else runs into this. Prior to Django 1.4 the use of formsets within formwizard is not supported. You have to upgrade to Django 1.4 or use the jquery solution. – het.oosten Jul 01 '12 at 11:52
  • Hi do you found a solution since then ? I'm also trying [to manage dynamic FormWizard](http://stackoverflow.com/questions/18836547/dynamic-formwizard) –  Sep 17 '13 at 07:40

0 Answers0