Guest User

Untitled

a guest
Oct 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.24 KB | None | 0 0
  1. # convert to dict
  2. def toDict(self):
  3. data = {}
  4. for f in self._meta.concrete_fields:
  5. o = f.value_from_object(self)
  6. if not isinstance(o, datetime.datetime):
  7. data[f.name] = f.value_from_object(self)
  8. return data
Add Comment
Please, Sign In to add comment