Guest User

Untitled

a guest
May 26th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. def __get__(self, obj, type=None):
  2. if obj is None:
  3. raise AttributeError('Can only be accessed via an instance.')
  4. if not obj.__dict__.has_key(self.field.name):
  5. # do lazy conversion now
  6. obj.__dict__[self.field.name] = self.field.to_python(obj.__dict__['_lazy_fields'][self.field.name])
  7.  
  8. return obj.__dict__[self.field.name]
Add Comment
Please, Sign In to add comment