forked from 0x2620/pandora
fix home editing
This commit is contained in:
parent
b3773d4ace
commit
19141fe96d
2 changed files with 3 additions and 3 deletions
|
@ -47,7 +47,7 @@ class Item(models.Model):
|
||||||
if not isinstance(data[key], string_types):
|
if not isinstance(data[key], string_types):
|
||||||
return False
|
return False
|
||||||
self.data[key] = data[key]
|
self.data[key] = data[key]
|
||||||
if key == 'contentid':
|
if key == 'contentid' and self.data[key]:
|
||||||
content = self.get_content()
|
content = self.get_content()
|
||||||
if not content:
|
if not content:
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -54,7 +54,7 @@ def editHomeItem(request, data):
|
||||||
response = json_response(status=500, text='failed to edit item')
|
response = json_response(status=500, text='failed to edit item')
|
||||||
else:
|
else:
|
||||||
response['data'] = item.json()
|
response['data'] = item.json()
|
||||||
add_changelog(request, data, item.get_id())
|
add_changelog(request, data)
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editHomeItem, cache=False)
|
actions.register(editHomeItem, cache=False)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ def removeHomeItem(request, data):
|
||||||
'''
|
'''
|
||||||
item = get_object_or_404_json(models.Item, id=ox.fromAZ(data['id']))
|
item = get_object_or_404_json(models.Item, id=ox.fromAZ(data['id']))
|
||||||
item.delete()
|
item.delete()
|
||||||
add_changelog(request, data, item.get_id())
|
add_changelog(request, data)
|
||||||
response = json_response()
|
response = json_response()
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(removeHomeItem, cache=False)
|
actions.register(removeHomeItem, cache=False)
|
||||||
|
|
Loading…
Reference in a new issue