Skip to content
Snippets Groups Projects
Commit d5fb5065 authored by Jan Maximilian Michal's avatar Jan Maximilian Michal
Browse files

Fixes #40. Added appropriate fields for the Django admin interface

parent 13d8e4fb
No related branches found
No related tags found
1 merge request!15Refactor
Pipeline #
This commit is part of merge request !15. Comments created here will be created in the context of that merge request.
......@@ -16,7 +16,7 @@ class UserCreationForm(forms.ModelForm):
class Meta:
model = UserAccount
fields = ()
fields = ('username',)
def clean_password2(self):
# Check that the two password entries match
......@@ -44,7 +44,7 @@ class UserChangeForm(forms.ModelForm):
class Meta:
model = UserAccount
fields = ('password', 'is_active', 'is_admin')
fields = ('username', 'password', 'is_active', 'is_admin')
def clean_password(self):
return self.initial["password"]
......@@ -62,14 +62,15 @@ class UserAdmin(BaseUserAdmin):
list_filter = ('is_admin',)
fieldsets = (
(None, {'fields': ('password',)}),
('Permissions', {'fields': ('is_admin',)}),
('Permissions',
{'fields': ('username', 'password', 'is_admin', 'is_active')}),
)
# add_fieldsets is not a standard ModelAdmin attribute. UserAdmin
# overrides get_fieldsets to use this attribute when creating a user.
add_fieldsets = (
(None, {
'classes': ('wide',),
'fields': ('password1', 'password2')}
'fields': ('username', 'password1', 'password2')}
),
)
filter_horizontal = ()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment