The following is a snippet of how I have setup my FormWizard. When I hit this view function, 'bar' gets printed once and 'foo' gets printed 7 times:
# views.py
def _show_repair_item_form_condition(wizard):
print 'foo'
return True
@login_required
def workshop(request):
print 'bar'
cw = WorkshopWizard.as_view([WorkshopRepairItemFormSet, EmptyForm], condition_dict={'0': _show_repair_item_form_condition})
return cw(request)
I have looked at the implmentation of the as_view function and can't find any trace of a bug causing this to happen. There is no documentation on the web about this issue either.
Any ideas?
Thanks, Mike
I know it's a late answer, but this is not a bug, and nothing to worry about. Looking up the call stack for the condition function, you'll find the calls in wizards/views.py:
callable(condition)
and of coursecondition = condition(self)
both call the function. For the former,wizard.storage.current_step
will beNone
. Here is the source code for Django 1.6: