We have a setup like below. We would really like to hide the
password and
verify_password fields in the form based on some some conditions which will vary based on parameters set elsewhere (sometimes it's very confusing to show those fields).
The closest thing I could find is
this post, which suggests "copying the dynamic field declaration inside the __field_widgets__ property"
It would be very helpful to see an example, or any other suggestions would be very much appreciated.
class UserAdminConfig(UserControllerConfig):
...
class defaultCrudRestController(ResourceManagerCrudRestController):
__form_options__ = {
'__require_fields__': ['user_name', 'email_address'],
'__omit_fields__': ['_password', 'created', '_groups', '_reset_password_key',
'reset_password_key', 'reset_password_expires'],
'__hide_fields__': ['user_id'],
'__field_order__': ['user_name', 'email_address', 'display_name', 'groups',
'password', 'verify_password'],
'__field_widget_types__': addopts(user_name=TextField,
email_address=TextField,
display_name=TextField),
'__field_widget_args__': addopts(password=CUSTOM_FORM_FIELD_OPTIONS)
}