gestiojeux/accounts/admin.py

39 lines
1 KiB
Python
Raw Permalink Normal View History

from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from django.utils.translation import gettext_lazy as _
from .models import User
class UserAdmin(DjangoUserAdmin):
fieldsets = (
(None, {"fields": ("email", "password")}),
(_("Personal info"), {"fields": ("public_name",)}),
(
_("Permissions"),
{
"fields": (
"is_active",
"is_staff",
"is_superuser",
"groups",
"user_permissions",
),
},
),
)
add_fieldsets = (
(
None,
{
"classes": ("wide",),
"fields": ("email", "public_name", "password1", "password2"),
},
),
)
list_display = ("public_name", "email", "is_staff")
search_fields = ("public_name", "email")
ordering = ("email",)
admin.site.register(User, UserAdmin)