mirror of https://github.com/django/django.git
Changed the handling of as_sql() versus _as_sql() in Query/QuerySet from r9928.
This avoids inadvertently hiding AttributeError that is raised for other reasons. git-svn-id: http://code.djangoproject.com/svn/django/trunk@9965 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f5063914b3
commit
c7a1a9f380
|
@ -198,9 +198,9 @@ class Field(object):
|
|||
# be invoked before the final SQL is evaluated
|
||||
if hasattr(value, 'relabel_aliases'):
|
||||
return value
|
||||
try:
|
||||
if hasattr(value, 'as_sql'):
|
||||
sql, params = value.as_sql()
|
||||
except AttributeError:
|
||||
else:
|
||||
sql, params = value._as_sql()
|
||||
return QueryWrapper(('(%s)' % sql), params)
|
||||
|
||||
|
|
|
@ -145,9 +145,9 @@ class RelatedField(object):
|
|||
# be invoked before the final SQL is evaluated
|
||||
if hasattr(value, 'relabel_aliases'):
|
||||
return value
|
||||
try:
|
||||
if hasattr(value, 'as_sql'):
|
||||
sql, params = value.as_sql()
|
||||
except AttributeError:
|
||||
else:
|
||||
sql, params = value._as_sql()
|
||||
return QueryWrapper(('(%s)' % sql), params)
|
||||
|
||||
|
|
Loading…
Reference in New Issue