

def __get__(self, instance, owner):
    super(ForeignKey, self)._set_up(instance, owner)
    if (not instance):
        return self.model
    if (not self.field):
        self.field = ('%s_id' % self.model.Meta.table)
    conditions = {
        self.model.Meta.pk: getattr(instance, self.field),
    }
    return Query(model=self.model, conditions=conditions)[0]

dataset/ETHPy150Open mimecuvalo/helloworld/packages/autumn/db/relations.py ForeignKey.__get__/original