forked from 0x2620/pandora
return current data
This commit is contained in:
parent
b23ca9df74
commit
390595a261
1 changed files with 4 additions and 2 deletions
|
@ -22,10 +22,11 @@ def addHomeItem(request, data):
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
item = models.Item()
|
item = models.Item()
|
||||||
|
response = json_response()
|
||||||
if not item.edit(data):
|
if not item.edit(data):
|
||||||
response = json_response(status=500, text='invalid data')
|
response = json_response(status=500, text='invalid data')
|
||||||
else:
|
else:
|
||||||
response = json_response()
|
response['data'] = item.json()
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(addHomeItem, cache=False)
|
actions.register(addHomeItem, cache=False)
|
||||||
|
|
||||||
|
@ -43,10 +44,11 @@ def editHomeItem(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']))
|
||||||
|
response = json_response()
|
||||||
if not item.edit(data):
|
if not item.edit(data):
|
||||||
response = json_response(status=500, text='failed to edit item')
|
response = json_response(status=500, text='failed to edit item')
|
||||||
else:
|
else:
|
||||||
response = json_response()
|
response['data'] = item.json()
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editHomeItem, cache=False)
|
actions.register(editHomeItem, cache=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue