我有一个向导视图,要求在第三步登录。它可以工作,但登录后向导不会继续到第四步,而是回到第一步。这很不方便
*views.py
FORMS = [("amount", forms.AmountToSendForm),
("confirm_amount", forms.ConfirmAmountForm),
("receiver", forms.ReceiverForm),
("card", forms.CardPaymentForm),
("bank", forms.BankPaymentForm),]
...
def login_user(request):
#login is as imported from django.contrib.auth.views
return login(request, template_name='roja/login.html', authentication_form=forms.LoginForm)
class PaymentWizard(SessionWizardView):
...
def dispatch(self, *args, **kwargs):
#initiate attributes of the dispatch method so that the .steps atrribute
#of the dispatch method can be exposed
response = super(PaymentWizard, self).dispatch(*args, **kwargs)
if self.steps.current == 'receiver':
@method_decorator(login_required) #as imported
def inner_dispatch(self, *args, **kwargs):
return super(PaymentWizard, self).dispatch(*args, **kwargs)
return inner_dispatch(self, *args, **kwargs)
else:
return response
*登录.html
...
<form action="{{ app_path }}" method="post" id="login-form" class="panel-body wrapper-lg">{% csrf_token %}
...
所以:
1.我怎样才能让它继续到第四步?
2. 鉴于我的实施,我需要注意任何安全注意事项吗?
感谢大家。