Changeset 7699
- Timestamp:
- 06/19/08 01:00:13 (5 months ago)
- Files:
-
- django/branches/gis/django/contrib/gis/db/backend/mysql/query.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/db/models/query.py (modified) (2 diffs)
- django/branches/gis/django/contrib/gis/db/models/sql/query.py (modified) (1 diff)
- django/branches/gis/django/contrib/gis/tests/geoapp/tests.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/gis/django/contrib/gis/db/backend/mysql/query.py
r7104 r7699 20 20 MYSQL_GIS_FUNCTIONS = { 21 21 'bbcontains' : 'MBRContains', # For consistency w/PostGIS API 22 'contained' : 'MBRWithin', # (ditto) 22 'bboverlaps' : 'MBROverlaps', # .. .. 23 'contained' : 'MBRWithin', # .. .. 23 24 'contains' : 'MBRContains', 24 25 'disjoint' : 'MBRDisjoint', django/branches/gis/django/contrib/gis/db/models/query.py
r7641 r7699 602 602 ForeignKey relation to the current model. 603 603 """ 604 # If this is an aggregate spatial query, the flag needs to be 605 # set on the `GeoQuery` object of this queryset. 606 if aggregate: self.query.aggregate = True 607 604 608 # Is this operation going to be on a related geographic field? 605 609 if not geo_field in self.model._meta.fields: … … 608 612 self.query.add_select_related([field_name]) 609 613 self.query.pre_sql_setup() 610 # Can't non-aggregate and aggregate selections together.611 if aggregate: self.query.aggregate = True612 614 rel_table, rel_col = self.query.related_select_cols[self.query.related_select_fields.index(geo_field)] 613 615 return self.query._field_column(geo_field, rel_table) django/branches/gis/django/contrib/gis/db/models/sql/query.py
r7641 r7699 148 148 return result, aliases 149 149 150 def get_ordering(self): 151 """ 152 This routine is overridden to disable ordering for aggregate 153 spatial queries. 154 """ 155 if not self.aggregate: 156 return super(GeoQuery, self).get_ordering() 157 else: 158 return () 159 150 160 def resolve_columns(self, row, fields=()): 151 161 """ django/branches/gis/django/contrib/gis/tests/geoapp/tests.py
r7641 r7699 432 432 qs = City.objects.filter(point__within=tx) 433 433 self.assertRaises(TypeError, qs.unionagg, 'name') 434 u1 = qs.unionagg(field_name='point') 435 u2 = qs.unionagg() 434 # Using `field_name` keyword argument in one query and specifying an 435 # order in the other (which should not be used because this is 436 # an aggregate method on a spatial column) 437 u1 = qs.unionagg(field_name='point') 438 u2 = qs.order_by('name').unionagg() 436 439 tol = 0.00001 437 440 if SpatialBackend.oracle:
