-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(#275) Allow users to change username when editing profile #279
Conversation
core/forms.py
Outdated
@@ -290,5 +290,5 @@ class UserAdminForm(CaseInsensitiveUsernameMixin, ContribUserChangeForm): | |||
expo_notif_tokens = forms.JSONField(required=False) | |||
|
|||
|
|||
class UserCreationForm(CaseInsensitiveUsernameMixin, ContribUserCreationForm): | |||
class UserCreationForm(CaseInsensitiveUsernameMixin, ContribAdminUserCreationForm): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry why does this need to be ADMIN user form?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core.UserCreationForm requires the same priveleges as django's AdminPasswordChangeForm (specific password-related form mixins) because passwords have to be dealt with when making a new user. I could either manually add the mixins to core.UserCreationForm or use django's AdminUserCreationForm (what I did above) which is almost identical to the normal UserCreationForm except for the fact that it comes with the mixins already.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core.UserCreationForm is only ever used in core.UserAdmin anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it might be better to rename core.UserCreationForm to core.UserCreationAdminForm in order to stay consistent. If you look inside admin.py:
from .forms import (
AnnouncementAdminForm,
AnnouncementSupervisorAdminForm,
EventAdminForm,
OrganizationAdminForm,
TagAdminForm,
TagSuperuserAdminForm,
TermAdminForm,
UserAdminForm,
UserCreationForm, # Not named as an admin form (?)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If that's the case then yeah, it should be
#275
also fixed a bug where the form for creating a new user in admin panel could not be loaded