Hi,
I'm currently using django 1.8 with django-formtools 1.0, I only use CBV.
I'm trying to build a wizard for a `Manifestation` model.
Each instance of `Manifestation` can have many Representations, which are
basically a place and a start date, using a ForeignKey to the Manifestation
instance.
My whole wizard is about those 2 models.
I can actually build the first forms of the wizard, based on ModelForm
class, each form has model=models.Manifestation in its Meta class.
I want to use an inlineformset in one of them.
I've done tests without the formset, and data in saved to db an the end of
wizard, which is OK.
That is my form :
class ManifestationWizardForm4(BetterModelForm): # BetterModelForm
implements fieldsets grouping for modeform
"""
`representation_formset` form
"""
class Meta:
model = models.Manifestation
fieldsets = [('infos', {'legend': u"Récapitulatif", 'fields':
('champ_artistique', 'titre', 'evenement')}),
# ('formset', {'legend': u'Représentations', 'fields':
('formset',) }),
]
widgets = {'champ_artistique': u_widgets.ReadOnlySelect,
'titre': u_widgets.ReadOnlyTextInput,
'evenement': u_widgets.ReadOnlySelect, }
formset = RepresentationManifestationFormSet()
As viewed in a post form this forum, I add my inlineformset as an attribute
of the form, I can display the (empty) whole form.
I've changed my form template to display the formset, it works perfectly.
I've questions about this :
* How can I get data from session to the `Manifestation` instance ? I would
like to use kind on <form_instance>.save(commit=False) to UPDATE the
`Manifestation` instance with data contained in the ModelForm, before
saving with commit=True at the end of the wizard. I don't know where to put
this...
* How to display my instance data in the *main* form ?
* how to initialize my formset with the `Manifestation` instance ?
Thanks for your help !
--
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 [email protected].
To post to this group, send email to [email protected].
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/17a69230-95c4-4e4b-9ef5-113fa6eeda94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.