don't fail if item is gone
This commit is contained in:
parent
91a7c0cede
commit
c6ba56188d
1 changed files with 8 additions and 4 deletions
|
@ -183,13 +183,17 @@ class Task(models.Model):
|
|||
def json(self):
|
||||
if self.status != 'canceled':
|
||||
self.update()
|
||||
return {
|
||||
data = {
|
||||
'started': self.started,
|
||||
'ended': self.ended,
|
||||
'status': self.status,
|
||||
'title': self.item.get('title'),
|
||||
'item': self.item.public_id,
|
||||
'user': self.user and self.user.username or '',
|
||||
'id': self.public_id,
|
||||
'user': self.user and self.user.username or '',
|
||||
}
|
||||
try:
|
||||
data['title'] = self.item.get('title')
|
||||
data['item'] = self.item.public_id
|
||||
except:
|
||||
pass
|
||||
return data
|
||||
|
||||
|
|
Loading…
Reference in a new issue