Pseudocode:
1.User Signup via following class-based view.
2.If signup success,then auto login and redirect to next url(enrollment) via GET method.
My problem is here.
how can i redirect to next url(enrollment) via POST method?
class StudentRegisterView(generic.CreateView):
form_class = StudentRegisterForm
template_name = 'attendance_system/register.html'
success_url = reverse_lazy("enrollment")
def form_valid(self,form):
valid = super(StudentRegisterView,self).form_valid(form)
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password1')
user = authenticate(username=username,password=password)
login(self.request,user)
return valid
question from:
https://stackoverflow.com/questions/65889330/how-can-i-redirect-to-next-url-via-post-method-with-django-generic-createview 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…