mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-03-03 19:08:15 +03:00
35 lines
1021 B
Python
35 lines
1021 B
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 {{ cookiecutter.project_slug }}.users.forms import UserChangeForm, UserCreationForm
|
|
|
|
User = get_user_model()
|
|
|
|
|
|
@admin.register(User)
|
|
class UserAdmin(auth_admin.UserAdmin):
|
|
|
|
form = UserChangeForm
|
|
add_form = UserCreationForm
|
|
fieldsets = (
|
|
(None, {"fields": ("username", "password")}),
|
|
(_("Personal info"), {"fields": ("name", "email")}),
|
|
(
|
|
_("Permissions"),
|
|
{
|
|
"fields": (
|
|
"is_active",
|
|
"is_staff",
|
|
"is_superuser",
|
|
"groups",
|
|
"user_permissions",
|
|
),
|
|
},
|
|
),
|
|
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
|
|
)
|
|
list_display = ["username", "name", "is_superuser"]
|
|
search_fields = ["name"]
|