本文整理匯總了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)