mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #19963 -- Added support for date_hierarchy across relations.
This commit is contained in:
committed by
Tim Graham
parent
89ca112884
commit
2f9c4e2b6f
@@ -393,7 +393,7 @@ with the admin site:
|
||||
which is not editable through the admin.
|
||||
* **admin.E126**: The value of ``search_fields`` must be a list or tuple.
|
||||
* **admin.E127**: The value of ``date_hierarchy`` refers to ``<field name>``,
|
||||
which is not an attribute of ``<model>``.
|
||||
which does not refer to a Field.
|
||||
* **admin.E128**: The value of ``date_hierarchy`` must be a ``DateField`` or
|
||||
``DateTimeField``.
|
||||
|
||||
|
||||
@@ -213,10 +213,19 @@ subclass::
|
||||
|
||||
date_hierarchy = 'pub_date'
|
||||
|
||||
You can also specify a field on a related model using the ``__`` lookup,
|
||||
for example::
|
||||
|
||||
date_hierarchy = 'author__pub_date'
|
||||
|
||||
This will intelligently populate itself based on available data,
|
||||
e.g. if all the dates are in one month, it'll show the day-level
|
||||
drill-down only.
|
||||
|
||||
.. versionchanged:: 1.11
|
||||
|
||||
The ability to reference fields on related models was added.
|
||||
|
||||
.. note::
|
||||
|
||||
``date_hierarchy`` uses :meth:`QuerySet.datetimes()
|
||||
|
||||
@@ -50,7 +50,7 @@ Minor features
|
||||
:mod:`django.contrib.admin`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* ...
|
||||
* :attr:`.ModelAdmin.date_hierarchy` can now reference fields across relations.
|
||||
|
||||
:mod:`django.contrib.admindocs`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user