On Mon, Oct 29, 2012 at 2:00 AM, Rogerio Carrasqueira <rogerio.carrasqueira@gmail.com> wrote:
-- Hi Everybody!I'm trying to the make a django form wizard based on this article http://elo80ka.wordpress.com/2009/10/28/using-a-formwizard-in-the-django-admin/, but I would like to know an approach to insert a inline form set inside a step of my wizard. I've tried to add a inline_form_set parameter value but nothing was happened with my form. Any Ideas?Thanks so much for help in advance.
Two pieces of information that may not be entirely obvious, but may help you understand how it's done:
1) An inline formset is just a specialisation of a formset, so anything you can do to an formset you can do to an inline formset as well
2) Formsets have an external interface that is intentionally the same as Forms - i.e., they have an is_valid() method and a clean() method.
So - it turns out you can use a formset (or, for that matter an inline formset) as a step in a wizard. If the formset requires additional data for the constructor (e.g., the instance), you can provide that data using the get_form_kwargs() method on the wizard itself.
If you're talking about having a form *and* an inline form set on the same page of the wizard, you'll need to mess around a little bit making the formset an attribute of the form; i.e., constructing the form will construct the formset as an attribute; you'll need to connect up the is_valid() method on the form to call is_valid() on the formset, and so on. Unfortunately, there isn't any real documentation for how you'd do this, so you'll need to tinker a little bit (although it might make a good blog post when you're done! :-)
Yours,
Russ Magee %-)
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.
No comments:
Post a Comment