From 4cd9d129142db39c3d819cc50b5b831abf7af255 Mon Sep 17 00:00:00 2001 From: Etzelia Date: Fri, 23 Nov 2018 09:38:37 -0600 Subject: [PATCH] Added display property to Token to make admin page more intuitive. --- api/admin.py | 2 +- api/models.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/api/admin.py b/api/admin.py index ac7579f..4a89974 100644 --- a/api/admin.py +++ b/api/admin.py @@ -22,7 +22,7 @@ class TokenActiveFilter(admin.SimpleListFilter): class TokenAdmin(admin.ModelAdmin): list_filter = (TokenActiveFilter,) - list_display = ('description', 'active', 'web_get_permission', 'web_post_permission', 'plugin_get_permission', + list_display = ('display', 'active', 'web_get_permission', 'web_post_permission', 'plugin_get_permission', 'plugin_post_permission', 'form_get_permission', 'form_post_permission', 'model_get_permission', 'model_post_permission', 'stats_get_permission', 'stats_post_permission') fieldsets = ( diff --git a/api/models.py b/api/models.py index 9ac1319..28948d8 100644 --- a/api/models.py +++ b/api/models.py @@ -17,5 +17,9 @@ class Token(models.Model): stats_get_permission = models.BooleanField("Stats GET", default=False) stats_post_permission = models.BooleanField("Stats POST", default=False) + @property + def display(self): + return self.description if self.description else self.key + def __str__(self): return self.key