mirror of
https://github.com/django/django.git
synced 2025-11-25 05:04:26 +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:
parent
cc870b8ef5
commit
cbb5cdd155
10 changed files with 111 additions and 253 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue