﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
9364	Spatial queries don't work on inherited geometry fields	jbronn	jbronn	"In the following models `TexasCity` inherits from `City`:

{{{
from django.contrib.gis.db import models

class City(models.Model):
    name = models.CharField(max_length=30)
    point = models.PointField()
    objects = models.GeoManager()

    def __unicode__(self): return self.name

class TexasCity(City):
    tx_county = models.CharField(max_length=30)
    objects = models.GeoManager() # Why does this need to be explicit?

    def __unicode__(self):
        return '%s (%s County)' % (self.name, self.tx_county)
}}}

When performing the following query:
{{{
In [4]: qs = TexasCity.objects.distance(pnt)
}}}

This SQL is generated, which is incorrect (there is no ""point"" column on the `TexasCity` model):
{{{
In [23]: qs.query.as_sql()
Out[23]: 
(u'SELECT (ST_distance_sphere(""tz_texascity"".""point"",%s)) AS ""distance"", ""tz_city"".""id"", ""tz_city"".""name"", ""tz_city"".""point"", ""tz_texascity"".""city_ptr_id"", ""tz_texascity"".""tx_county"" FROM ""tz_texascity"" INNER JOIN ""tz_city"" ON (""tz_texascity"".""city_ptr_id"" = ""tz_city"".""id"")',
 (<django.contrib.gis.db.backend.postgis.adaptor.PostGISAdaptor object at 0x319b610>,))
}}}
"		closed	GIS	1.0		fixed	gis inheritance		Unreviewed	0	0	1	0	0	0
