[Answered ]-Authenticate/register user in step 2/3 of Form Wizard in django

2👍

You can override dispatch method and return PermissionDenied after checking for the current step.

Remember, you need to run the parent first, since dispatch is filling up instance with all needed wizard data.

Pseudocode:

def dispatch(self, request, *args, **kwargs):
    response = super(MyWizardView, self).dispatch(request, *args, **kwargs)

    if self.steps.current == '2'
        if not request.user.is_authenticated():
            raise PermissionDenied

    return response

Leave a comment