mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #31558 -- Added support for boolean attribute on properties in ModelAdmin.list_display.
This commit is contained in:
parent
2f1ab16be5
commit
225328efd9
7 changed files with 29 additions and 0 deletions
|
@ -796,6 +796,7 @@ subclass::
|
|||
@admin.display(
|
||||
ordering="last_name",
|
||||
description="Full name of the person",
|
||||
boolean=False,
|
||||
)
|
||||
def full_name(self):
|
||||
return self.first_name + " " + self.last_name
|
||||
|
@ -816,9 +817,14 @@ subclass::
|
|||
|
||||
my_property.short_description = "Full name of the person"
|
||||
my_property.admin_order_field = "last_name"
|
||||
my_property.boolean = False
|
||||
|
||||
full_name = property(my_property)
|
||||
|
||||
.. versionchanged:: 5.0
|
||||
|
||||
Support for ``boolean`` attribute on properties was added.
|
||||
|
||||
* The field names in ``list_display`` will also appear as CSS classes in
|
||||
the HTML output, in the form of ``column-<field_name>`` on each ``<th>``
|
||||
element. This can be used to set column widths in a CSS file for example.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue