commit | ec2ff77cd2fecf6ca8d2abcce2b69a670d73208e | [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 | 5f455167d9aa0fcd41d810e59c275a5188f24e77 | |
parent | d5f674d9e64aa72d8bee3b9142d5a9b9efa7092b [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