示例#1
0
 def todict(self):
     d = modeltodict(self)
     if self.user is not None:
         d['user'] = self.user.todict()
     if self.equipment is not None:
         d['equipment'] = self.equipment.todict()
     return d
示例#2
0
 def todict(self, notifications=False):
     d = modeltodict(self, exclude='password')
     if notifications:
         a = []
         for item in self.notification_set.filter(unread=True):
             a.append({
                 'id': item.id,
                 'content': item.content
             })
         d['notifications'] = a
     return d
示例#3
0
 def todict(self):
     d = modeltodict(self)
     d['user'] = self.user.todict()
     d['equipment'] = self.equipment.todict()
     return d
示例#4
0
 def todict(self):
     d = modeltodict(self)
     d['user'] = self.user.todict()
     return d
示例#5
0
 def todict(self):
     d = modeltodict(self)
     d['provider'] = self.provider.todict()
     return d