gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
47
core/http/admin/user.py
Normal file
47
core/http/admin/user.py
Normal file
@@ -0,0 +1,47 @@
|
||||
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",)
|
||||
Reference in New Issue
Block a user