Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Question: Keep the next argument configured for the register form even if inputs fail validation #841

Open
anglofox opened this issue May 16, 2019 · 1 comment

Comments

@anglofox
Copy link

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.

@jwag956
Copy link
Collaborator

jwag956 commented May 17, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants