예제 #1
0
 def light_dict(self):
     """
     Lighter weight option when you don't need a full list of letters
     """
     return {
         'id': self.pk,
         'editor': self.editor.profile.to_dict(),
         'created': date_to_string(self.created),
         'modified': date_to_string(self.modified),
         "date_finished": date_to_string(self.date_finished),
         'letter_count': self.letters.count(),
     }
예제 #2
0
 def light_dict(self):
     """
     Lighter weight option when you don't need a full list of letters
     """
     return {
         'id': self.pk,
         'editor': self.editor.profile.to_dict(),
         'created': date_to_string(self.created),
         'modified': date_to_string(self.modified),
         "date_finished": date_to_string(self.date_finished),
         'letter_count': self.letters.count(),
     }
예제 #3
0
 def to_dict(self):
     return {
         'id': self.pk,
         'org_id': self.org_id,
         'org': self.org.to_dict() if self.org else None,
         'sender': self.sender.profile.to_dict(),
         'recipient': self.recipient.profile.to_dict() if self.recipient else None,
         'recipient_address': self.recipient_address,
         'body': self.body,
         'is_postcard': self.is_postcard,
         'type': self.type,
         'comments': [c.to_dict() for c in self.comments.all()],
         'document': self.document.to_dict() if self.document else None,
         'created': date_to_string(self.created),
         'sent': date_to_string(self.sent),
         'send_anonymously': self.send_anonymously,
     }
예제 #4
0
 def to_dict(self):
     obj = self.content_object()
     props = {
             'id': self.pk,
             'user_id': self.user_id,
             'scan_id': self.scan_id,
             'document_id': self.document_id,
             'resolved': date_to_string(self.resolved),
             'important': self.important,
             'text': self.text,
             'object': obj.to_dict(),
             'object_type': obj._meta.object_name.lower(),
             'creator': self.creator.profile.to_dict(),
             'modified': date_to_string(self.modified),
             'created': date_to_string(self.created),
     }
     return props
예제 #5
0
 def to_dict(self):
     return {
         'id': self.pk,
         'org_id': self.org_id,
         'org': self.org.to_dict() if self.org else None,
         'sender': self.sender.profile.to_dict(),
         'recipient':
         self.recipient.profile.to_dict() if self.recipient else None,
         'recipient_address': self.recipient_address,
         'body': self.body,
         'is_postcard': self.is_postcard,
         'type': self.type,
         'comments': [c.to_dict() for c in self.comments.all()],
         'document': self.document.to_dict() if self.document else None,
         'created': date_to_string(self.created),
         'sent': date_to_string(self.sent),
         'send_anonymously': self.send_anonymously,
     }