summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-09-22 11:45:51 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-09-22 11:47:34 +0200
commitbaa33cd8faa16737524b1ac355802a10dd63571c (patch)
tree4d8049f01ef4eca8943f6618c0f0592762c8e228 /docs
parent59afc18f3735abfd7ab4b1a904000a547daed4ca (diff)
Fixed #16218 -- date_list order in generic CBVs.
Thanks nnrcschmdt for the report and bpeschier for the initial version of the patch.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/class-based-views/mixins-date-based.txt12
-rw-r--r--docs/releases/1.5.txt15
2 files changed, 23 insertions, 4 deletions
diff --git a/docs/ref/class-based-views/mixins-date-based.txt b/docs/ref/class-based-views/mixins-date-based.txt
index 01181ebb6c..561e525e70 100644
--- a/docs/ref/class-based-views/mixins-date-based.txt
+++ b/docs/ref/class-based-views/mixins-date-based.txt
@@ -318,12 +318,16 @@ BaseDateListView
Returns the aggregation period for ``date_list``. Returns
:attr:`~BaseDateListView.date_list_period` by default.
- .. method:: get_date_list(queryset, date_type=None)
+ .. method:: get_date_list(queryset, date_type=None, ordering='ASC')
Returns the list of dates of type ``date_type`` for which ``queryset``
contains entries. For example, ``get_date_list(qs, 'year')`` will
return the list of years for which ``qs`` has entries. If
``date_type`` isn't provided, the result of
- :meth:`BaseDateListView.get_date_list_period` is used. See
- :meth:`~django.db.models.query.QuerySet.dates()` for the ways that the
- ``date_type`` argument can be used.
+ :meth:`~BaseDateListView.get_date_list_period` is used. ``date_type``
+ and ``ordering`` are simply passed to
+ :meth:`QuerySet.dates()<django.db.models.query.QuerySet.dates>`.
+
+ .. versionchanged:: 1.5
+ The ``ordering`` parameter was added, and the default order was
+ changed to ascending.
diff --git a/docs/releases/1.5.txt b/docs/releases/1.5.txt
index e2eac09237..528a44c5a1 100644
--- a/docs/releases/1.5.txt
+++ b/docs/releases/1.5.txt
@@ -152,6 +152,21 @@ year|date:"Y" }}``.
``next_year`` and ``previous_year`` were also added in the context. They are
calculated according to ``allow_empty`` and ``allow_future``.
+Context in year and month archive class-based views
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+:class:`~django.views.generic.dates.YearArchiveView` and
+:class:`~django.views.generic.dates.MonthArchiveView` were documented to
+provide a ``date_list`` sorted in ascending order in the context, like their
+function-based predecessors, but it actually was in descending order. In 1.5,
+the documented order was restored. You may want to add (or remove) the
+``reversed`` keyword when you're iterating on ``date_list`` in a template::
+
+ {% for date in date_list reversed %}
+
+:class:`~django.views.generic.dates.ArchiveIndexView` still provides a
+``date_list`` in descending order.
+
Context in TemplateView
~~~~~~~~~~~~~~~~~~~~~~~