コード例 #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)
コード例 #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)
コード例 #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)
コード例 #4
0
ファイル: query.py プロジェクト: 77720616/django
 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)