From c60a33874fdbec1bb115592ce01d160eea7de427 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 4 Feb 2019 20:11:45 +0200 Subject: [PATCH] Quicker admin. --- hc/accounts/admin.py | 4 +++- hc/api/admin.py | 10 +--------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/hc/accounts/admin.py b/hc/accounts/admin.py index 0b7eff75..4bbd1f83 100644 --- a/hc/accounts/admin.py +++ b/hc/accounts/admin.py @@ -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 = { diff --git a/hc/api/admin.py b/hc/api/admin.py index 92bc6e66..e404789b 100644 --- a/hc/api/admin.py +++ b/hc/api/admin.py @@ -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):