From dfcf20edae9e256cd40b4fb14339eebf24f71f76 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 7 Jan 2012 16:20:33 +0530 Subject: [PATCH] edit pages --- pandora/app/views.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pandora/app/views.py b/pandora/app/views.py index 37b55a39..93e4ecb3 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -112,14 +112,14 @@ def editPage(request): } } ''' - if not request.user.is_staff: + 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) - 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}) return render_to_json_response(response) actions.register(editPage)