

@classmethod
def _check_geo_field(cls, opts, lookup):
    "\n        Utility for checking the given lookup with the given model options.\n        The lookup is a string either specifying the geographic field, e.g.\n        'point, 'the_geom', or a related lookup on a geographic field like\n        'address__point'.\n\n        If a GeometryField exists according to the given lookup on the model\n        options, it will be returned.  Otherwise returns None.\n        "
    from django.contrib.gis.db.models.fields import GeometryField
    field_list = lookup.split(LOOKUP_SEP)
    field_list.reverse()
    fld_name = field_list.pop()
    try:
        geo_fld = opts.get_field(fld_name)
        while len(field_list):
            opts = geo_fld.remote_field.model._meta
            geo_fld = opts.get_field(field_list.pop())
    except (FieldDoesNotExist, AttributeError):
        return False
    if isinstance(geo_fld, GeometryField):
        return geo_fld
    else:
        return False

dataset/ETHPy150Open django/django/django/contrib/gis/db/models/lookups.py GISLookup._check_geo_field/original