From 390f1edb34ce718bfad1701d84151788b2eb68d1 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 6 Nov 2011 15:41:19 +0100 Subject: [PATCH] removeSubscribers --- pandora/itemlist/views.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/pandora/itemlist/views.py b/pandora/itemlist/views.py index 83a3cd5e6..a8279024e 100644 --- a/pandora/itemlist/views.py +++ b/pandora/itemlist/views.py @@ -378,6 +378,28 @@ def editList(request): return render_to_json_response(response) actions.register(editList, cache=False) +@login_required_json +def removeSubscribers(request): + ''' + param data { + list: listId, + } + return { + status: {'code': int, 'text': string}, + data: { + } + } + ''' + data = json.loads(request.POST['data']) + list = get_list_or_404_json(data['list']) + response = json_response() + if list.editable(request.user): + for user in list.subscribed_users.all(): + list.subscribed_users.remove(user) + else: + response = json_response(status=403, text='not allowed') + return render_to_json_response(response) +actions.register(removeSubscribers, cache=False) @login_required_json def removeList(request):