forked from 0x2620/pandora
changelog
This commit is contained in:
parent
b8f191b3c9
commit
50f6c33159
1 changed files with 5 additions and 0 deletions
|
@ -2,8 +2,10 @@ from django.shortcuts import render
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
from oxdjango.shortcuts import render_to_json_response, get_object_or_404_json, json_response
|
||||||
|
|
||||||
from user.decorators import capability_required_json
|
from user.decorators import capability_required_json
|
||||||
from oxdjango.api import actions
|
from oxdjango.api import actions
|
||||||
|
from changelog.models import add_changelog
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
@ -29,6 +31,7 @@ def addHomeItem(request, data):
|
||||||
response = json_response(status=500, text='invalid data')
|
response = json_response(status=500, text='invalid data')
|
||||||
else:
|
else:
|
||||||
response['data'] = item.json()
|
response['data'] = item.json()
|
||||||
|
add_changelog(request, data, item.get_id())
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(addHomeItem, cache=False)
|
actions.register(addHomeItem, cache=False)
|
||||||
|
|
||||||
|
@ -51,6 +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())
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
actions.register(editHomeItem, cache=False)
|
actions.register(editHomeItem, cache=False)
|
||||||
|
|
||||||
|
@ -66,6 +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())
|
||||||
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