Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a test failure introduced in [14461].

git-svn-id: http://code.djangoproject.com/svn/django/trunk@14462 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e2a0de0b935659922df8c4b03741d6ebfaed0ee0 1 parent abaa3ed
@alex alex authored
Showing with 12 additions and 7 deletions.
  1. +12 −7 django/db/models/sql/subqueries.py
View
19 django/db/models/sql/subqueries.py
@@ -4,7 +4,7 @@
from django.core.exceptions import FieldError
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.datastructures import Date
from django.db.models.sql.expressions import SQLEvaluator
@@ -189,12 +189,17 @@ def add_date_select(self, field_name, lookup_type, order='ASC'):
"""
Converts the query into a date extraction query.
"""
- result = self.setup_joins(
- field_name.split(LOOKUP_SEP),
- self.get_meta(),
- self.get_initial_alias(),
- False
- )
+ try:
+ result = self.setup_joins(
+ field_name.split(LOOKUP_SEP),
+ self.get_meta(),
+ 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]
assert isinstance(field, DateField), "%r isn't a DateField." \
% field.name
Please sign in to comment.
Something went wrong with that request. Please try again.