edit pages
This commit is contained in:
parent
fa05c9d297
commit
dfcf20edae
1 changed files with 7 additions and 7 deletions
|
@ -112,14 +112,14 @@ def editPage(request):
|
|||
}
|
||||
}
|
||||
'''
|
||||
if not request.user.is_staff:
|
||||
response = json_response(status=403, text='permission denied')
|
||||
return render_to_json_response(response)
|
||||
if request.user.get_profile().capabilities('canEditSitePages'):
|
||||
data = json.loads(request.POST['data'])
|
||||
page, created = models.Page.objects.get_or_create(name=data['name'])
|
||||
page.body = data['body']
|
||||
page.save()
|
||||
response = json_response({'name': page.name, 'page': page.body})
|
||||
else:
|
||||
response = json_response(status=403, text='permission denied')
|
||||
return render_to_json_response(response)
|
||||
actions.register(editPage)
|
||||
|
||||
|
|
Loading…
Reference in a new issue