removeSubscribers

This commit is contained in:
j 2011-11-06 15:41:19 +01:00
parent a265135654
commit 390f1edb34

View file

@ -378,6 +378,28 @@ def editList(request):
return render_to_json_response(response) return render_to_json_response(response)
actions.register(editList, cache=False) 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 @login_required_json
def removeList(request): def removeList(request):