Verified Commit a57d9751 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

See #152: updated admin interface

parent 4ce6715d
......@@ -5,6 +5,7 @@ from django import forms
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as AuthUserAdmin
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.utils.translation import ugettext_lazy as _
from .models import User
......@@ -41,8 +42,22 @@ class UserAdmin(AuthUserAdmin):
'email',
'date_joined',
'last_login',
'privacy_level',
'is_staff',
'is_superuser',
]
list_filter = [
'is_superuser',
'is_staff',
'privacy_level',
'permission_settings',
'permission_library',
'permission_federation',
]
fieldsets = (
(None, {'fields': ('username', 'password', 'privacy_level')}),
(_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),
(_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser',
'permission_library', 'permission_settings', 'permission_federation')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
......@@ -46,9 +46,17 @@ class User(AbstractUser):
blank=True, null=True, max_length=255)
# permissions
permission_federation = models.BooleanField(default=False)
permission_library = models.BooleanField(default=False)
permission_settings = models.BooleanField(default=False)
permission_federation = models.BooleanField(
'Manage library federation',
help_text='Follow other instances, accept/deny library follow requests...',
default=False)
permission_library = models.BooleanField(
'Manage library',
help_text='Import new content, manage existing content',
default=False)
permission_settings = models.BooleanField(
'Manage instance-level settings',
default=False)
def __str__(self):
return self.username
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment