From f328ebdede9e10779c1fb93d45f72dade7eda23f Mon Sep 17 00:00:00 2001 From: Renato Oliveira <renato@labcodes.com.br> Date: Fri, 11 Sep 2015 10:14:35 -0500 Subject: [PATCH] [1.8.x] Fixed #25382 -- Removed obsolete references to DateQuerySet. Backport of e3720b990a33ae259da4b1f1f6069aa6bbc8c03d from master --- .../class-based-views/generic-date-based.txt | 26 +++++++------------ docs/ref/models/querysets.txt | 6 ++--- tests/aggregation_regress/tests.py | 2 +- tests/queries/tests.py | 6 ++--- 4 files changed, 17 insertions(+), 23 deletions(-) diff --git a/docs/ref/class-based-views/generic-date-based.txt b/docs/ref/class-based-views/generic-date-based.txt index 81b42e0982..d8b7933138 100644 --- a/docs/ref/class-based-views/generic-date-based.txt +++ b/docs/ref/class-based-views/generic-date-based.txt @@ -48,11 +48,9 @@ ArchiveIndexView :class:`django.views.generic.dates.BaseDateListView`), the template's context will be: - * ``date_list``: A - :meth:`DateQuerySet<django.db.models.query.QuerySet.dates>` object - containing all years that have objects available according to - ``queryset``, represented as - :class:`datetime.datetime<python:datetime.datetime>` objects, in + * ``date_list``: A :meth:`QuerySet <django.db.models.query.QuerySet.dates>` + object containing all years that have objects available according to + ``queryset``, represented as :class:`datetime.datetime` objects, in descending order. **Notes** @@ -128,11 +126,9 @@ YearArchiveView :class:`django.views.generic.dates.BaseDateListView`), the template's context will be: - * ``date_list``: A - :meth:`DateQuerySet<django.db.models.query.QuerySet.dates>` object - containing all months that have objects available according to - ``queryset``, represented as - :class:`datetime.datetime<python:datetime.datetime>` objects, in + * ``date_list``: A :meth:`QuerySet <django.db.models.query.QuerySet.dates>` + object containing all months that have objects available according to + ``queryset``, represented as :class:`datetime.datetime` objects, in ascending order. * ``year``: A :class:`~datetime.date` object @@ -223,12 +219,10 @@ MonthArchiveView :class:`~django.views.generic.dates.BaseDateListView`), the template's context will be: - * ``date_list``: A - :meth:`DateQuerySet<django.db.models.query.QuerySet.dates>` object - containing all days that have objects available in the given month, - according to ``queryset``, represented as - :class:`datetime.datetime<python:datetime.datetime>` objects, in - ascending order. + * ``date_list``: A :meth:`QuerySet <django.db.models.query.QuerySet.dates>` + object containing all days that have objects available in the given month, + according to ``queryset``, represented as :class:`datetime.datetime` + objects, in ascending order. * ``month``: A :class:`~datetime.date` object representing the given month. diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index c794bb27ef..c5f83a7cf4 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -660,9 +660,9 @@ dates .. method:: dates(field, kind, order='ASC') -Returns a ``DateQuerySet`` — a ``QuerySet`` that evaluates to a list of -:class:`datetime.date` objects representing all available dates of a -particular kind within the contents of the ``QuerySet``. +Returns a ``QuerySet`` that evaluates to a list of :class:`datetime.date` +objects representing all available dates of a particular kind within the +contents of the ``QuerySet``. ``field`` should be the name of a ``DateField`` of your model. ``kind`` should be either ``"year"``, ``"month"`` or ``"day"``. Each diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py index 12bb1ae3f4..793775c41b 100644 --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -568,7 +568,7 @@ class AggregationTests(TestCase): lambda b: b.name ) - # Regression for #10248 - Annotations work with DateQuerySets + # Regression for #10248 - Annotations work with dates() qs = Book.objects.annotate(num_authors=Count('authors')).filter(num_authors=2).dates('pubdate', 'day') self.assertQuerysetEqual( qs, [ diff --git a/tests/queries/tests.py b/tests/queries/tests.py index 84871e8dfe..deb195fe9c 100644 --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -741,7 +741,7 @@ class Queries1Tests(BaseQuerysetTest): 3 ) - # Pickling of DateQuerySets used to fail + # Pickling of QuerySets using datetimes() should work. qs = Item.objects.datetimes('created', 'month') pickle.loads(pickle.dumps(qs)) @@ -1303,8 +1303,8 @@ class Queries3Tests(BaseQuerysetTest): self.assertQuerysetEqual(Valid.objects.all(), []) def test_ticket8683(self): - # Raise proper error when a DateQuerySet gets passed a wrong type of - # field + # An error should be raised when QuerySet.datetimes() is passed the + # wrong type of field. self.assertRaisesMessage( AssertionError, "'name' isn't a DateTimeField.",