mirror of https://github.com/django/django.git
[1.6.x] Fixed #22250 -- regression in gis compiler for non-concrete fields
Thanks to gwahl@fusionbox.com for the report.
Backport of 21f208e66e
from master
This commit is contained in:
parent
f659c8e13a
commit
31892af3f0
|
@ -123,7 +123,7 @@ class GeoSQLCompiler(compiler.SQLCompiler):
|
||||||
seen = self.query.included_inherited_models.copy()
|
seen = self.query.included_inherited_models.copy()
|
||||||
if start_alias:
|
if start_alias:
|
||||||
seen[None] = start_alias
|
seen[None] = start_alias
|
||||||
for field, model in opts.get_fields_with_model():
|
for field, model in opts.get_concrete_fields_with_model():
|
||||||
if from_parent and model is not None and issubclass(from_parent, model):
|
if from_parent and model is not None and issubclass(from_parent, model):
|
||||||
# Avoid loading data for already loaded parents.
|
# Avoid loading data for already loaded parents.
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -777,3 +777,12 @@ class GeoQuerySetTest(TestCase):
|
||||||
self.assertEqual(True, union.equals_exact(u2, tol))
|
self.assertEqual(True, union.equals_exact(u2, tol))
|
||||||
qs = City.objects.filter(name='NotACity')
|
qs = City.objects.filter(name='NotACity')
|
||||||
self.assertEqual(None, qs.unionagg(field_name='point'))
|
self.assertEqual(None, qs.unionagg(field_name='point'))
|
||||||
|
|
||||||
|
def test_non_concrete_field(self):
|
||||||
|
pkfield = City._meta.get_field_by_name('id')[0]
|
||||||
|
orig_pkfield_col = pkfield.column
|
||||||
|
pkfield.column = None
|
||||||
|
try:
|
||||||
|
list(City.objects.all())
|
||||||
|
finally:
|
||||||
|
pkfield.column = orig_pkfield_col
|
||||||
|
|
Loading…
Reference in New Issue