本文整理汇总了Python中django.contrib.gis.db.models.lookups.GISLookup._check_geo_field方法的典型用法代码示例。如果您正苦于以下问题:Python GISLookup._check_geo_field方法的具体用法?Python GISLookup._check_geo_field怎么用?Python GISLookup._check_geo_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.gis.db.models.lookups.GISLookup
的用法示例。
在下文中一共展示了GISLookup._check_geo_field方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _geo_field
# 需要导入模块: from django.contrib.gis.db.models.lookups import GISLookup [as 别名]
# 或者: from django.contrib.gis.db.models.lookups.GISLookup import _check_geo_field [as 别名]
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)