Skip to content
Snippets Groups Projects
Commit 49465454 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Merge branch 'is-internal-admin' into 'master'

Add User.is_internal and remove Group from the admin

Closes #385

See merge request !888
parents f8ae7021 2e179147
No related branches found
No related tags found
1 merge request!888Add User.is_internal and remove Group from the admin
......@@ -44,7 +44,7 @@ class UserChangeForm(forms.ModelForm):
class Meta:
model = User
fields = ('email', 'password', 'is_active', 'is_admin')
fields = ('email', 'password', 'is_active', 'is_admin', 'is_internal')
def clean_password(self):
# Regardless of what the user provides, return the initial value.
......@@ -66,10 +66,10 @@ class UserAdmin(BaseUserAdmin):
# These override the definitions on the base UserAdmin
# that reference specific fields on auth.User.
list_display = ('email', 'is_admin')
list_filter = ('is_admin', 'groups')
list_filter = ('is_admin', 'is_internal')
fieldsets = (
(None, {'fields': ('email', 'verified_email', 'password', 'transkribus_email')}),
('Permissions', {'fields': ('is_admin', 'groups')}),
('Permissions', {'fields': ('is_admin', 'is_internal')}),
)
# add_fieldsets is not a standard ModelAdmin attribute. UserAdmin
# overrides get_fieldsets to use this attribute when creating a user.
......@@ -85,12 +85,6 @@ class UserAdmin(BaseUserAdmin):
inlines = (CorpusRightInline, )
class GroupAdmin(admin.ModelAdmin):
list_display = ('name', )
search_fields = ('name', )
fields = ('name', )
class UserScopeAdmin(admin.ModelAdmin):
list_display = ('user', 'scope')
list_filter = [('scope', EnumFieldListFilter), ]
......@@ -98,8 +92,6 @@ class UserScopeAdmin(admin.ModelAdmin):
# Now register the new UserAdmin...
admin.site.register(User, UserAdmin)
# ... and, since we're not using Django's built-in permissions,
# use a custom GroupAdmin to hide them.
# and hide the unused Group admin
admin.site.unregister(Group)
admin.site.register(Group, GroupAdmin)
admin.site.register(UserScope, UserScopeAdmin)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment