2022-10-25 23:29:13 +03:00
|
|
|
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 image_markuper.users.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")}),
|
|
|
|
(
|
|
|
|
_("Permissions"),
|
|
|
|
{
|
|
|
|
"fields": (
|
|
|
|
"is_active",
|
|
|
|
"is_staff",
|
|
|
|
"is_superuser",
|
|
|
|
"groups",
|
|
|
|
"user_permissions",
|
|
|
|
),
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
|
|
|
|
)
|
2022-10-26 23:22:04 +03:00
|
|
|
list_display = ["username", "is_superuser"]
|
|
|
|
search_fields = ["username"]
|