Today I ran into a problem while creating a Form Wizard for the first time. I was using Django 1.3 with django-debug-toolbar v0.8.5 on Python 2.6, and when I tried to view the form wizard I got this error:
TemplateSyntaxError at /form/
Caught AttributeError while rendering: ‘FormWizard’ object has no attribute ‘__name__’
This is not just a problem with Django Debug Toolbar. There are also a number of Django decorators that raise an AttributeError when you use them to decorate a form wizard instance. To make everyone happy, it’s easiest to just declare the __name__ property in your form wizard classes.
1 2 3 4 5 6 7 | class RegistrationWizard(FormWizard): @property def __name__(self): return self.__class__.__name__ def done(self, request, form_list): return HttpResponseRedirect(reverse('registration_complete')) |