1
0
mirror of https://github.com/django/django.git synced 2025-07-04 17:59:13 +00:00

gis: Return field value from Feature.get based on either field name or the field itself.

git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@5604 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jeremy Dunck 2007-07-04 06:52:40 +00:00
parent 44069054d7
commit a183dd8225

View File

@ -93,8 +93,9 @@ class Feature(object):
return OGRGeomType(lgdal.OGR_FD_GetGeomType(self._fdefn))
#### Feature Methods ####
def get(self, field_name):
def get(self, field):
"Returns the value of the field, instead of an instance of the Field object."
field_name = getattr(field, 'name', field)
return self.__getitem__(field_name).value
def index(self, field_name):