Стартавая модель задачника
This commit is contained in:
62
system/accounts/admin.py
Normal file
62
system/accounts/admin.py
Normal file
@@ -0,0 +1,62 @@
|
||||
# Системные приложения
|
||||
import logging
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.contrib.admin.models import LogEntry, DELETION
|
||||
from django.utils.html import escape
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.urls import reverse
|
||||
# Внутриние приложения
|
||||
from system.accounts.models import User
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class ProfileInline(admin.StackedInline):
|
||||
model = User
|
||||
can_delete = False
|
||||
max_num = 1
|
||||
verbose_name = 'Profile'
|
||||
verbose_name_plural = 'Profile'
|
||||
fk_name = 'user'
|
||||
|
||||
@admin.register(User)
|
||||
class UserAdmin(UserAdmin):
|
||||
ordering = ('email', )
|
||||
list_display = (
|
||||
'id', 'email', 'is_staff', 'is_superuser', 'is_active', 'date_joined',
|
||||
'last_updated', 'last_login'
|
||||
#'verified_email', 'accepted_terms', 'read_terms',
|
||||
)
|
||||
search_fields = ('email',)
|
||||
list_filter = (
|
||||
'is_staff', 'is_superuser', 'is_active',
|
||||
#'verified_email'
|
||||
)
|
||||
readonly_fields = (
|
||||
'last_login', 'last_updated', 'date_joined'
|
||||
#'email_token',
|
||||
)
|
||||
list_display_links = ('id', 'email')
|
||||
fieldsets = (
|
||||
(None, {'fields': ('email', 'password')}),
|
||||
('Permissions', {'fields': ('groups', 'user_permissions')}),
|
||||
('Roles', {'fields': ('is_staff', 'is_superuser', 'is_active')}),
|
||||
#('Additional', {'fields': (
|
||||
#'verified_email', 'email_token', 'accepted_terms', 'read_terms'
|
||||
#)}),
|
||||
('Profile', {'fields': (
|
||||
'first_name','last_name', 'gender', 'bio', 'image',
|
||||
'address', 'followers'
|
||||
)}),
|
||||
('Dates', {'fields': ('last_login', 'last_updated', 'date_joined')})
|
||||
)
|
||||
add_fieldsets = (
|
||||
(None, {
|
||||
'classes': ('wide', ),
|
||||
'fields': (
|
||||
'email', 'password1', 'password2'
|
||||
)
|
||||
}),
|
||||
)
|
||||
|
||||
#inlines = (ProfileInline, )
|
||||
Reference in New Issue
Block a user