This commit is contained in:
j 2017-02-23 16:32:52 +01:00
parent 5947f2295b
commit 50bb40291c

View file

@ -48,9 +48,8 @@ class Item(models.Model):
return False return False
self.data[key] = data[key] self.data[key] = data[key]
if key == 'contentid': if key == 'contentid':
try: content = self.get_content()
content = self.get_content() if not content:
except:
return False return False
changed = True changed = True
if 'type' in data: if 'type' in data:
@ -101,18 +100,21 @@ class Item(models.Model):
return None return None
data = None data = None
content = None content = None
if type == 'list': try:
content = List.get(contentid) if type == 'list':
data = content.json(keys=content_keys) content = List.get(contentid)
data['link'] = '/list==' + quote(data['user'] + ':' + data['name']) data = content.json(keys=content_keys)
elif type == 'edit': data['link'] = '/list==' + quote(data['user'] + ':' + data['name'])
content = Edit.get(contentid) elif type == 'edit':
data = content.json(keys=content_keys) content = Edit.get(contentid)
data['link'] = '/edits/' + quote(data['user'] + ':' + data['name']) data = content.json(keys=content_keys)
elif type == 'collection': data['link'] = '/edits/' + quote(data['user'] + ':' + data['name'])
content = Collection.get(contentid) elif type == 'collection':
data = content.json(keys=content_keys) content = Collection.get(contentid)
data['link'] = '/documents/collection==' + quote(data['user'] + ':' + data['name']) data = content.json(keys=content_keys)
data['link'] = '/documents/collection==' + quote(data['user'] + ':' + data['name'])
except:
return None
if content and content.status == 'private': if content and content.status == 'private':
self.delete() self.delete()
data = None data = None