1
0
mirror of https://github.com/django/django.git synced 2025-10-28 08:06:09 +00:00

Fixed #16117 -- Added decorators for admin action and display functions.

Refs #25134, #32099.
This commit is contained in:
Nick Pope
2021-01-13 16:19:22 +00:00
committed by GitHub
parent 83fcfc9ec8
commit 9204485396
18 changed files with 422 additions and 148 deletions

View File

@@ -19,6 +19,7 @@ class EventAdmin(admin.ModelAdmin):
date_hierarchy = 'date'
list_display = ['event_date_func']
@admin.display
def event_date_func(self, event):
return event.date
@@ -171,6 +172,6 @@ class EmptyValueChildAdmin(admin.ModelAdmin):
empty_value_display = '-empty-'
list_display = ('name', 'age_display', 'age')
@admin.display(empty_value='†')
def age_display(self, obj):
return obj.age
age_display.empty_value_display = '†'