Skip to content

Commit e206f08

Browse files
authored
feat: add ability to search fields and filter fields in Account admin view (#91)
* feat: reorder fields in list view and add adminship boolean field to User * feat: add filter fields and search fields to Account admin view
1 parent d98b6e7 commit e206f08

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/accounts/admin.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ def is_token_valid_display(self, instance):
2828
@admin.register(Account)
2929
class AccountAdminView(admin.ModelAdmin):
3030
list_display = (
31-
"email",
32-
"is_active",
3331
"unique_identifier",
32+
"email",
3433
"username",
3534
"is_confirmed",
3635
"is_verified",
36+
"is_active",
37+
"is_staff",
3738
"legacy_id",
3839
)
3940
fieldsets = (
@@ -57,9 +58,16 @@ class AccountAdminView(admin.ModelAdmin):
5758
"is_active",
5859
"is_confirmed",
5960
"is_verified",
61+
"is_staff",
6062
),
6163
},
6264
),
6365
("Legacy", {"classes": ("wide",), "fields": ("legacy_id",)}),
6466
)
6567
inlines = [AccountConfirmationInline, PasswordResetRequestInline]
68+
list_filter = ("is_staff", "is_verified", "is_confirmed", "is_active")
69+
search_fields = (
70+
"email__icontains",
71+
"username__icontains",
72+
"unique_identifier__icontains",
73+
)

0 commit comments

Comments
 (0)