Passing Different Templates in Django Form Wizard

524 Views Asked by At

I want to pass different template in each step for my django form wizard.

I want to check each step from form wizard's get_template() function. If I try :

def get_template(self,step):
    if step == 1:
        return 'test_1.html'
    return 'test_2.html'

It returns test_2.html. I'm checking my steps from my template and generate a form according to step's number but it doesn't seem to good way to do this. Any idea ?

1

There are 1 best solutions below

0
On BEST ANSWER

According to the docs on Advanced FormWizard methods, step is a zero-based counter.

So on the first form, step is 0, not 1. Could that be catching you out? You might want to change your code to:

if step == 0: