Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated `GeoWhere` to be compatible with changes in r9700.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9702 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 391736e73749dc71a37fda94409ac8fa26738097 1 parent f747b61
Justin Bronn authored January 05, 2009
14  django/contrib/gis/db/models/sql/where.py
@@ -29,7 +29,10 @@ def add(self, data, connector):
29 29
         """
30 30
         if not isinstance(data, (list, tuple)):
31 31
             return super(WhereNode, self).add(data, connector)
32  
-        alias, col, field, lookup_type, value = data     
  32
+
  33
+        obj, lookup_type, value = data
  34
+        alias, col, field = obj.alias, obj.col, obj.field
  35
+
33 36
         if not hasattr(field, "_geom"):
34 37
             # Not a geographic field, so call `WhereNode.add`.
35 38
             return super(GeoWhereNode, self).add(data, connector)
@@ -43,18 +46,17 @@ def add(self, data, connector):
43 46
             # the `get_geo_where_clause` to construct the appropriate
44 47
             # spatial SQL when `make_atom` is called.
45 48
             annotation = GeoAnnotation(field, value, where)
46  
-            return super(WhereNode, self).add((alias, col, field.db_type(), lookup_type,
47  
-                                               annotation, params), connector)
  49
+            return super(WhereNode, self).add((obj, lookup_type, annotation, params), connector)
48 50
 
49 51
     def make_atom(self, child, qn):
50  
-        table_alias, name, db_type, lookup_type, value_annot, params = child
51  
- 
  52
+        lvalue, lookup_type, value_annot, params = child
  53
+
52 54
         if isinstance(value_annot, GeoAnnotation):
53 55
             if lookup_type in SpatialBackend.gis_terms:
54 56
                 # Getting the geographic where clause; substitution parameters
55 57
                 # will be populated in the GeoFieldSQL object returned by the
56 58
                 # GeometryField.
57  
-                gwc = get_geo_where_clause(table_alias, name, lookup_type, value_annot)
  59
+                gwc = get_geo_where_clause(lvalue.alias, lvalue.col, lookup_type, value_annot)
58 60
                 return gwc % value_annot.where, params
59 61
             else:
60 62
                 raise TypeError('Invalid lookup type: %r' % lookup_type)

0 notes on commit 391736e

Please sign in to comment.
Something went wrong with that request. Please try again.