本文整理汇总了Python中django.contrib.gis.gdal.field.Field方法的典型用法代码示例。如果您正苦于以下问题:Python field.Field方法的具体用法?Python field.Field怎么用?Python field.Field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.gis.gdal.field
的用法示例。
在下文中一共展示了field.Field方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getitem__
# 需要导入模块: from django.contrib.gis.gdal import field [as 别名]
# 或者: from django.contrib.gis.gdal.field import Field [as 别名]
def __getitem__(self, index):
"""
Gets the Field object at the specified index, which may be either
an integer or the Field's string label. Note that the Field object
is not the field's _value_ -- use the `get` method instead to
retrieve the value (e.g. an integer) instead of a Field instance.
"""
if isinstance(index, six.string_types):
i = self.index(index)
else:
if index < 0 or index > self.num_fields:
raise OGRIndexError('index out of range')
i = index
return Field(self, i)
示例2: get
# 需要导入模块: from django.contrib.gis.gdal import field [as 别名]
# 或者: from django.contrib.gis.gdal.field import Field [as 别名]
def get(self, field):
"""
Returns the value of the field, instead of an instance of the Field
object. May take a string of the field name or a Field object as
parameters.
"""
field_name = getattr(field, 'name', field)
return self[field_name].value