commit | f8888ed723015c39e098e068fb4263b30a14c6f2 | [log] [tgz] |
---|---|---|
author | Sapan Bhatia <gwsapan@gmail.com> | Wed Apr 06 19:03:35 2016 +0200 |
committer | Sapan Bhatia <gwsapan@gmail.com> | Wed Apr 06 19:03:35 2016 +0200 |
tree | b8173f1e10554e24f39e848de7dd347730c1d091 | |
parent | 4471a05997a844b99ad9723b681e399ef445bd02 [diff] |
Make models serializable for extended logging
diff --git a/xos/core/models/plcorebase.py b/xos/core/models/plcorebase.py index 99acc15..4170697 100644 --- a/xos/core/models/plcorebase.py +++ b/xos/core/models/plcorebase.py
@@ -300,3 +300,11 @@ @classmethod def is_ephemeral(cls): return cls in ephemeral_models + + def tologdict(self): + try: + d = {'model_name':self.__class__.__name__, 'pk': self.pk} + except: + d = {} + + return d