如何在Django视图中乘以success_url?

时间:2019-07-18 13:00:16

标签: python django django-views django-urls

如何在Django视图中将success_url乘以?我试过了,但是没用:

class ResetPasswordRequestView(FormView):
    template_name = "registration/password_reset_form.html"
    form_class = PasswordResetRequestForm

    def post(self, request, *args, **kwargs):
         form = self.form_class(request.POST)
         if form.is_valid():
              data = form.cleaned_data["email_or_username"]
         if self.validate_email_address(data) is True:
              success_url = '/reset/password/email/'
         else:
              success_url = '/reset/password/username/'

1 个答案:

答案 0 :(得分:0)

您可以覆盖form_valid method [Django-doc],然后返回 List<Person> newList = arrayList.stream() .sorted(Comparator.reverseOrder(Person::getAge)) //Error .limit(3) .collect(Collectors.toList()); newList.forEach(System.out::println);

HttpResponseRedirect