Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
from django.contrib.auth import admin
|
|
from import_export import admin as import_export
|
|
from import_export.admin import ImportExportModelAdmin
|
|
|
|
from core.http.forms import CustomUserCreationForm
|
|
|
|
|
|
class CustomUserAdmin(admin.UserAdmin, ImportExportModelAdmin):
|
|
add_form = CustomUserCreationForm
|
|
list_display = ["id", "phone", "first_name", "last_name", "role"]
|
|
search_fields = ["phone", "first_name", "last_name"]
|
|
list_filter = ["role"]
|
|
fieldsets = (
|
|
(None, {"fields": ("username", "phone", "password")}),
|
|
(
|
|
"Personal info",
|
|
{"fields": ("first_name", "last_name", "email", "role", "avatar", "fcm_token")},
|
|
),
|
|
(
|
|
"Permissions",
|
|
{
|
|
"fields": (
|
|
"is_active",
|
|
"is_staff",
|
|
"is_superuser",
|
|
"groups",
|
|
"user_permissions",
|
|
)
|
|
},
|
|
),
|
|
("Important dates", {"fields": ("last_login", "date_joined")}),
|
|
)
|
|
add_fieldsets = (
|
|
(
|
|
None,
|
|
{
|
|
"classes": ("wide",),
|
|
"fields": ("phone", "password1", "password2"),
|
|
},
|
|
),
|
|
)
|
|
|
|
|
|
class GroupAdmin(import_export.ImportExportModelAdmin):
|
|
list_display = ["name"]
|
|
search_fields = ["name"]
|
|
filter_horizontal = ("permissions",)
|