Open anglofox opened 5 years ago
So when register fails validation it will return the REGISTER_USER_TEMPLATE template (the same that was just submitted) - with of course error values populated.
1) I believe the RegisterForm (which you extended?) has the NextFormMixin - so that it does in fact already have a (hidden) field in the form called 'next'. That gets automatically populated. So you should be able to find that in the returned form and again add that the next time as a query param to the request.
2) If you need to add additional fields or for some reason the NextFormMixin isn't quite doing what you want - you can add a register_context_process which can add any values to the form you need.
I have an ExtendedRegisterForm that customizes the RegisterForm. It's configured with the next argument, so that upon successful registration, I can configure the next route.
But, if you mess up the registration form (ex: type a username that doesn't meet my validation criteria), I lose the next parameter when the error message is displayed.
I'm curious how to keep the next parameter in the url query parameters.