Spaces:
Configuration error
Configuration error
File size: 1,201 Bytes
52a3fd6 99122b8 52a3fd6 99122b8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from .models import User
class AdminUser(UserAdmin):
list_display = ["email", "first_name", "last_name", "role", "is_active", "created"]
fieldsets = (
(
None,
{
"fields": (
"first_name",
"last_name",
"mobile",
"email",
"password",
)
},
),
(
"Permissions",
{
"fields": (
"role",
"is_active",
"is_staff",
"is_superuser",
"user_permissions",
)
},
),
)
add_fieldsets = (
(None, {"classes": ("wide",), "fields": ("email", "password1", "password2")}),
)
list_filter = ("role", "is_active")
search_fields = ("email", "first_name", "last_name")
ordering = ("email",)
filter_horizontal = (
"groups",
"user_permissions",
)
admin.site.register(User, AdminUser)
# admin.site.unregister(Group)
|