forked from OWASP/Nest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.py
More file actions
39 lines (30 loc) · 745 Bytes
/
admin.py
File metadata and controls
39 lines (30 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""Nest app admin."""
from django.contrib import admin
from apps.nest.models.api_key import ApiKey
from apps.nest.models.user import User
class UserAdmin(admin.ModelAdmin):
ordering = ("username",)
search_fields = ("email", "username")
class ApiKeyAdmin(admin.ModelAdmin):
list_display = (
"name",
"user",
"uuid",
"is_revoked",
"expires_at",
"created_at",
"last_used_at",
)
list_filter = (
"expires_at",
"created_at",
"last_used_at",
)
ordering = ("-created_at",)
search_fields = (
"name",
"uuid",
"user__username",
)
admin.site.register(ApiKey, ApiKeyAdmin)
admin.site.register(User, UserAdmin)