mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #30259 -- Added support for admin_order_field attribute on properties in ModelAdmin.list_display.
This commit is contained in:
parent
ea60b7bc74
commit
044cc54420
7 changed files with 36 additions and 4 deletions
|
@ -55,6 +55,11 @@ class Article(models.Model):
|
|||
model_year_reversed.admin_order_field = '-date'
|
||||
model_year_reversed.short_description = ''
|
||||
|
||||
def property_year(self):
|
||||
return self.date.year
|
||||
property_year.admin_order_field = 'date'
|
||||
model_property_year = property(property_year)
|
||||
|
||||
|
||||
class Book(models.Model):
|
||||
"""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue