Make it easier to use a custom user model with user create/edit/account settings forms
See original GitHub issueIs your proposal related to a problem?
When a project creates a custom user model where first_name
and last_name
are optional, the Wagtail forms still display the fields as being required. In order to make the form fields optional, the developer must override the WAGTAIL_USER-EDIT_FORM
and WAGTAIL_USER_CREATION_FORM
with custom-defined models. They must also somehow override the Account Settings form for the user profile section (which I am still not clear how to do).
At the very least, the process is somewhat ambiguous, despite the available documentation:
- https://docs.wagtail.io/en/stable/advanced_topics/customisation/custom_user_models.html
- https://docs.wagtail.io/en/stable/advanced_topics/customisation/custom_account_settings.html
Describe the solution you’d like
Ideally, the forms would introspect the custom user model to determine whether the fields are required. Furthermore, it might be good to simplify the development process and just allow the user to specify a list of fields to render in the forms rather than creating three custom forms (create/edit/account settings).
Describe alternatives you’ve considered
The documentation could be improved around how to customize the user account settings form.
Additional context
We have a downstream issue where it became apparent how confusing it is to make changes to the user create and edit forms, as well as a follow-up to split the work:
- https://github.com/brylie/wagtail-social-network/issues/18
- https://github.com/brylie/wagtail-social-network/issues/27
I am also trying to customize the user account settings form to make the fields optional and finding myself at a loss as to how to proceed.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top GitHub Comments
No, not the docs. The current
wagtail.admin.forms.account.NameEmailForm
would have to be adapted to supportsettings.WAGTAIL_USER_CUSTOM_FIELDS
anddjango.contrib.auth.base_user.AbstractBaseUser.REQUIRED_FIELDS
.Almost the same problem here. Found this issue page by googling “NameEmailSettingsPanel”.
In my case the custom user model contains no name fields. I’ve managed to remove those fields from the user creation and admin forms using:
Unfortunately I have not succeeded in removing them from the user account form.