[Django]-Using different templates with django form wizard

9👍

get_template_names doesn’t accept arguments. You can’t just define a new argument for a function to accept and hope the framework will pass it in! (for your future troubleshooting)

Judging by the WizardView source, it looks like you can access the currently active step via self.steps.current which you could use in your get_template_names view to return a path containing the step.

class AddWizard(SessionWizardView):
        def get_template_names(self):
            return ['step_{0}_template.html'.format(self.steps.current)]

I’m not sure if current is a string or integer or what – but one look at the view and you should find a useful “can’t find template named X” error.

Leave a comment