mirror of https://github.com/django/django.git
Fixed a test failure introduced in [14461].
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
abaa3ed4bd
commit
e2a0de0b93
|
@ -4,7 +4,7 @@ Query subclasses which provide extra functionality beyond simple data retrieval.
|
||||||
|
|
||||||
from django.core.exceptions import FieldError
|
from django.core.exceptions import FieldError
|
||||||
from django.db import connections
|
from django.db import connections
|
||||||
from django.db.models.fields import DateField
|
from django.db.models.fields import DateField, FieldDoesNotExist
|
||||||
from django.db.models.sql.constants import *
|
from django.db.models.sql.constants import *
|
||||||
from django.db.models.sql.datastructures import Date
|
from django.db.models.sql.datastructures import Date
|
||||||
from django.db.models.sql.expressions import SQLEvaluator
|
from django.db.models.sql.expressions import SQLEvaluator
|
||||||
|
@ -189,12 +189,17 @@ class DateQuery(Query):
|
||||||
"""
|
"""
|
||||||
Converts the query into a date extraction query.
|
Converts the query into a date extraction query.
|
||||||
"""
|
"""
|
||||||
result = self.setup_joins(
|
try:
|
||||||
field_name.split(LOOKUP_SEP),
|
result = self.setup_joins(
|
||||||
self.get_meta(),
|
field_name.split(LOOKUP_SEP),
|
||||||
self.get_initial_alias(),
|
self.get_meta(),
|
||||||
False
|
self.get_initial_alias(),
|
||||||
)
|
False
|
||||||
|
)
|
||||||
|
except FieldError:
|
||||||
|
raise FieldDoesNotExist("%s has no field named '%s'" % (
|
||||||
|
self.model._meta.object_name, field_name
|
||||||
|
))
|
||||||
field = result[0]
|
field = result[0]
|
||||||
assert isinstance(field, DateField), "%r isn't a DateField." \
|
assert isinstance(field, DateField), "%r isn't a DateField." \
|
||||||
% field.name
|
% field.name
|
||||||
|
|
Loading…
Reference in New Issue