mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #18353 -- Inconsistency in date-based CBVs.
This commit is contained in:
parent
f4abba5200
commit
3b2993ed04
4 changed files with 49 additions and 5 deletions
|
@ -1171,7 +1171,15 @@ YearArchiveView
|
|||
have objects available according to ``queryset``, represented as
|
||||
``datetime.datetime`` objects, in ascending order.
|
||||
|
||||
* ``year``: The given year, as a four-character string.
|
||||
* ``year``: A ``datetime.date`` object representing the given year.
|
||||
|
||||
* ``next_year``: A ``datetime.date`` object representing the first day
|
||||
of the next year. If the next year is in the future, this will be
|
||||
``None``.
|
||||
|
||||
* ``previous_year``: A ``datetime.date`` object representing the first
|
||||
day of the previous year. Unlike ``next_year``, this will never be
|
||||
``None``.
|
||||
|
||||
**Notes**
|
||||
|
||||
|
|
|
@ -71,6 +71,18 @@ Backwards incompatible changes in 1.5
|
|||
deprecation timeline for a given feature, its removal may appear as a
|
||||
backwards incompatible change.
|
||||
|
||||
Context in year archive class-based views
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
For consistency with the other date-based generic views,
|
||||
:class:`~django.views.generic.dates.YearArchiveView` now passes ``year`` in
|
||||
the context as a :class:`datetime.date` rather than a string. If you are
|
||||
using ``{{ year }}`` in your templates, you must replace it with ``{{
|
||||
year|date:"Y" }}``.
|
||||
|
||||
``next_year`` and ``previous_year`` were also added in the context. They are
|
||||
calculated according to ``allow_empty`` and ``allow_future``.
|
||||
|
||||
Features deprecated in 1.5
|
||||
==========================
|
||||
|
||||
|
@ -86,4 +98,4 @@ our own copy of ``simplejson``. You can safely change any use of
|
|||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
The :func:`~django.utils.itercompat.product` function has been deprecated. Use
|
||||
the built-in `itertools.product` instead.
|
||||
the built-in :func:`itertools.product` instead.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue