Form Container for Django Formwizard only shows labels

66 views
Skip to first unread message

Jur Remeijn

unread,
Sep 16, 2015, 9:19:33 AM9/16/15
to Django users
So in my Django project, I am using a formwizard for a multi-page form. On one of those pages, I want a form as well as a formset (sadly, this is absolutely necessary). The formwizard can do these things separately but not together, so I found this ticket () on the django development side,  which brought me to the use of a form_container like this one.

Now for using this container, i have in my forms.py:
"
AddressesFormSet = formset_factory(EmailAddressForm)

class UserFormsContainer(FormContainer):
    user = UserDetailForm
    addresses = AddressesFormSet
"

In my urls.py:
    url(r'^$', views.ContactWizard.as_view([("0", UserFormsContainer),]), name='index'),

Only, when I call this container in the formwizard (which should work), the html output is this:
''<form action="" method="post"><input type="hidden" name="csrfmiddlewaretoken" value="8Xnov8eCwnenDgBiUbstzPXsUDsFeBom">''

''user''
''addresses''
''<table>''
''<input id="id_full_form_view-current_step" name="full_form_view-current_step" type="hidden" value="0"></table>''
''<input type="submit" value="next">''
''</form>''

Instead of the actual forms I expected...

I think the problem might be in the following part of the form container, because it describes the behaviour of the form as I see it (it shows me the labels for the forms in the container).

    def get_form_kwargs(self, prefix, **kwargs):
        """Return per-form kwargs for instantiating a specific form

        By default, just returns the kwargs provided. prefix is the
        label for the form in the container, allowing you to specify
        extra (or less) kwargs for each form in the container.
        """
        return kwargs

However, I want it to actually show the forms, but since I am not very familliar with the django source-code I don't know how to edit my formcontainer to do this.

Can anyone help me with this issue? Thanks in advance!
Reply all
Reply to author
Forward
0 new messages