Added display property to Token to make admin page more intuitive.

reminder
Etzelia 2018-11-23 09:38:37 -06:00 committed by John Olheiser
parent c16c480620
commit 4cd9d12914
2 changed files with 5 additions and 1 deletions

View File

@ -22,7 +22,7 @@ class TokenActiveFilter(admin.SimpleListFilter):
class TokenAdmin(admin.ModelAdmin): class TokenAdmin(admin.ModelAdmin):
list_filter = (TokenActiveFilter,) 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', 'plugin_post_permission', 'form_get_permission', 'form_post_permission', 'model_get_permission',
'model_post_permission', 'stats_get_permission', 'stats_post_permission') 'model_post_permission', 'stats_get_permission', 'stats_post_permission')
fieldsets = ( fieldsets = (

View File

@ -17,5 +17,9 @@ class Token(models.Model):
stats_get_permission = models.BooleanField("Stats GET", default=False) stats_get_permission = models.BooleanField("Stats GET", default=False)
stats_post_permission = models.BooleanField("Stats POST", 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): def __str__(self):
return self.key return self.key