Browse Source

Quicker admin.

pull/194/head
Pēteris Caune 6 years ago
parent
commit
c60a33874f
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 4 additions and 10 deletions
  1. +3
    -1
      hc/accounts/admin.py
  2. +1
    -9
      hc/api/admin.py

+ 3
- 1
hc/accounts/admin.py View File

@ -41,10 +41,11 @@ class ProfileAdmin(admin.ModelAdmin):
readonly_fields = ("user", "email")
raw_id_fields = ("current_project", )
search_fields = ["id", "user__email"]
list_per_page = 50
list_select_related = ("user", )
list_display = ("id", "email", "engagement", "date_joined", "last_login",
"projects", "invited", "sms", "reports_allowed")
search_fields = ["id", "user__email"]
list_filter = ("user__date_joined", "user__last_login",
"reports_allowed", "check_limit")
@ -111,6 +112,7 @@ class ProjectAdmin(admin.ModelAdmin):
readonly_fields = ("code", "owner")
list_select_related = ("owner", )
list_display = ("id", "name_", "users", "engagement", "switch")
search_fields = ["id", "name", "owner__email"]
class Media:
css = {


+ 1
- 9
hc/api/admin.py View File

@ -145,21 +145,13 @@ class PingsAdmin(admin.ModelAdmin):
search_fields = ("owner__name", "owner__code")
readonly_fields = ("owner", )
list_select_related = ("owner", )
list_display = ("id", "created", "owner", "email", "scheme", "method",
list_display = ("id", "created", "owner", "scheme", "method",
"ua")
list_filter = ("created", SchemeListFilter, MethodListFilter,
KindListFilter)
paginator = LargeTablePaginator
def get_queryset(self, request):
qs = super().get_queryset(request)
qs = qs.annotate(email=F("owner__project__owner__email"))
return qs
def email(self, obj):
return obj.email
@admin.register(Channel)
class ChannelsAdmin(admin.ModelAdmin):


Loading…
Cancel
Save