

def __get__(self, instance, owner):
    '\n        Retrieves and caches the value from the datastore on the first lookup.\n        Returns the cached value.\n        '
    from django.db.models.fields import FieldDoesNotExist
    assert (instance is not None)
    cls = self.model_ref()
    data = instance.__dict__
    if (data.get(self.field_name, self) is self):
        try:
            cls._meta.get_field_by_name(self.field_name)
            name = self.field_name
        except FieldDoesNotExist:
            name = [f.name for f in cls._meta.fields if (f.attname == self.field_name)][0]
        val = getattr(val._base_manager.filter(pk=instance.pk).only(name).using(instance._state.db).get(), self.field_name)
        data[self.field_name] = val
    return data[self.field_name]

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/django/db/models/query_utils.py DeferredAttribute.__get__/VarMisuse@128/192 `cls`->`val`