1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #23867 -- removed DateQuerySet hacks

The .dates() queries were implemented by using custom Query, QuerySet,
and Compiler classes. Instead implement them by using expressions and
database converters APIs.
This commit is contained in:
Anssi Kääriäinen
2014-11-18 11:24:33 +02:00
committed by Tim Graham
parent cc870b8ef5
commit cbb5cdd155
10 changed files with 111 additions and 253 deletions

View File

@@ -2,7 +2,7 @@ from __future__ import unicode_literals
import datetime
from django.db.models.fields import FieldDoesNotExist
from django.core.exceptions import FieldError
from django.test import TestCase
from django.utils import six
@@ -93,8 +93,9 @@ class DatesTests(TestCase):
def test_dates_fails_when_given_invalid_field_argument(self):
six.assertRaisesRegex(
self,
FieldDoesNotExist,
"Article has no field named 'invalid_field'",
FieldError,
"Cannot resolve keyword u?'invalid_field' into field. Choices are: "
"categories, comments, id, pub_date, title",
Article.objects.dates,
"invalid_field",
"year",