On Mon, Feb 8, 2016 at 5:36 AM, Martín Torre Castro <
martin.torre.cas...@gmail.com> wrote:

> If I understand well, you mean that my form templates have to extend the
> main wizard template. Is that correct?
>
> In previous versions this was achieved by writing template_name =
> 'main_wizard_template.html' into the subclass of WizardView. Am I wrong?
>
> So, with {% extends 'registration/test_wizard.html' %} in 
> *registration/test_step1.html
> and **registration/test_step2.html* it should work.
>
> I will try tonight.
> Thanks.
>
>
Yes, the templates referenced in each step should extend your main
template, if you are doing something fancy in the template used for each
step.

Given the template in your OP, you probably don't even need to specify a
template per step, since you aren't doing anything different other than
having Django/formtools print the form using the default styling. A simple
class attribute like template_name = 'registration/test_wizard.html' would
probably suffice, since it should act as the fallback template if you don't
specify a template per step, and get rid of get_template_names() entirely
(since you're using the same template for every step). Your entire Wizard
class can probably look like this:

class WizardTest(SessionWizardView):
    template_name = 'registration/test_wizard.html'

    # Method called when all is done
    def done(self, form_list, **kwargs):
        return HttpResponseRedirect('/url-to-redirect-to/')

Obviously you'll need to have the other scaffolding in place for this to
work (list of forms passed to the view in the urls.py file, etc.), and I
don't believe any of the forms will be saved in this state (you'll need to
do that as part of your done() method), but everything should display and
should give you a base to work from.

-James

-- 
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciWrCr5HE74ikCaQEHHre-Mg_vE6Bjri878z3-45n-o-Eg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to