Пример #1
0
 def _geo_field(self, field_name=None):
     """
     Returns the first Geometry field encountered or the one specified via
     the `field_name` keyword. The `field_name` may be a string specifying
     the geometry field on this GeoQuerySet'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 field in self.model._meta.fields:
             if isinstance(field, GeometryField):
                 return field
         return False
     else:
         # Otherwise, check by the given field name -- which may be
         # a lookup to a _related_ geographic field.
         return GISLookup._check_geo_field(self.model._meta, field_name)
Пример #2
0
import warnings