Example #1
0
 def make_atom(self, child, qn, connection):
     lvalue, lookup_type, value_annot, params_or_value = child
     # if spatial query
     if isinstance(lvalue, GeoConstraint):
         return GeoWhereNode.make_atom(self, child, qn, connection)
     # else might be an HSTORE query
     return HStoreWhereNode.make_atom(self, child, qn, connection)
Example #2
0
 def make_atom(self, child, qn, connection):
     lvalue, lookup_type, value_annot, params_or_value = child
     # if spatial query
     if isinstance(lvalue, GeoConstraint):
         return GeoWhereNode.make_atom(self, child, qn, connection)
     # else might be an HSTORE query
     return HStoreWhereNode.make_atom(self, child, qn, connection)
Example #3
0
 def _geo_field(self, field_name=None):
     """
     Returns the first Geometry field encountered; or specified via the
     `field_name` keyword.  The `field_name` may be a string specifying
     the geometry field on this GeoQuery's model, or a lookup string
     to a geometry field via a ForeignKey relation.
     """
     if field_name is None:
         # Incrementing until the first geographic field is found.
         for fld in self.model._meta.fields:
             if isinstance(fld, GeometryField): return fld
         return False
     else:
         # Otherwise, check by the given field name -- which may be
         # a lookup to a _related_ geographic field.
         return GeoWhereNode._check_geo_field(self.model._meta, field_name)
Example #4
0
 def _geo_field(self, field_name=None):
     """
     Returns the first Geometry field encountered; or specified via the
     `field_name` keyword.  The `field_name` may be a string specifying
     the geometry field on this GeoQuery's model, or a lookup string
     to a geometry field via a ForeignKey relation.
     """
     if field_name is None:
         # Incrementing until the first geographic field is found.
         for fld in self.model._meta.fields:
             if isinstance(fld, GeometryField): return fld
         return False
     else:
         # Otherwise, check by the given field name -- which may be
         # a lookup to a _related_ geographic field.
         return GeoWhereNode._check_geo_field(self.model._meta, field_name)