Re: How to insert a inline form inside a form wizard?

2013-10-24 Thread Fabio Caritas Barrionuevo da Luz
Hello Russel. 
First, sorry for reviving this topic.
Thanks for the comment on this topic, however, this matter is still not 
clear to me.
 
You will also create a blog post explaining the details of CookieWizardView 
/ SessionWizardView + formset and inlineformset?

I am a relatively new django User.

My current challenge:
I have the following class models to my Gas station manager django app: 
https://dl.dropboxusercontent.com/u/66970738/arq_p_foruns/posto.png

I need to create a WizzardView Gas Station(Posto), and create related 
models , and some models related models related to Gas Station(Posto) .

In the initial step , the User shall inform the name of the Gas 
Station(Posto) and the number of pumps(Bomba) and tanks(Tanque) of Gas 
Station(Posto).

In the second step , based on number of pumps(Bomba) and tanks(Tanque) set 
in an initial step, the amount of displayed forms pumps(Bomba) and 
tanks(Tanque).

For each pump(Bomba), the User should inline insert nozzle(Bico).

for me , the ideal solution would be that the django have its " simple " to 
do so , within and outside the django admin .

Maybe something like described in issue 9025 and comment of the silverfix

https://code.djangoproject.com/ticket/9025#comment:163

ps.: Sorry for my horrible English. I'm still learning. I am Brazilian. 
Short life to google translator, I hope I can survive without it as fast as 
possible. :-)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/538e5dac-8845-4ed5-a3be-751135906c0c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How to insert a inline form inside a form wizard?

2012-10-28 Thread Russell Keith-Magee
On Mon, Oct 29, 2012 at 2:00 AM, Rogerio Carrasqueira <
rogerio.carrasque...@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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.