mirror of
https://github.com/Alexander-D-Karpov/akarpov
synced 2025-02-22 16:30:31 +03:00
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from django.contrib import admin
|
|
from django.contrib.auth import admin as auth_admin
|
|
from django.contrib.auth import get_user_model
|
|
from django.utils.translation import gettext_lazy as _
|
|
|
|
from .forms import UserAdminChangeForm, UserAdminCreationForm
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
@admin.register(User)
|
|
class UserAdmin(auth_admin.UserAdmin):
|
|
form = UserAdminChangeForm
|
|
add_form = UserAdminCreationForm
|
|
fieldsets = (
|
|
(None, {"fields": ("username", "password")}),
|
|
(_("Personal info"), {"fields": ("email",)}),
|
|
(_("Images"), {"fields": ("image", "image_cropped")}),
|
|
(
|
|
_("Permissions"),
|
|
{
|
|
"fields": (
|
|
"is_active",
|
|
"is_staff",
|
|
"is_superuser",
|
|
"groups",
|
|
"user_permissions",
|
|
),
|
|
},
|
|
),
|
|
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
|
|
(_("Other"), {"fields": ("short_link", "left_file_upload")}),
|
|
)
|
|
list_display = ["username", "is_superuser"]
|
|
search_fields = ["username", "email"]
|