Fixed agenda tree, fixed #1635.

This commit is contained in:
Norman Jäckel 2015-09-14 22:18:55 +02:00
parent b431f41b2c
commit 2a23150b78
2 changed files with 14 additions and 6 deletions

View File

@ -394,7 +394,7 @@ angular.module('OpenSlidesApp.agenda.site', ['OpenSlidesApp.agenda'])
// set changed agenda tree
$scope.treeOptions = {
dropped: function() {
$http.put('/rest/agenda/item/tree/', {tree: $scope.tree});
$http.put('/rest/agenda/item/tree/', {tree: $scope.items});
}
};
}

View File

@ -200,12 +200,20 @@ class ItemViewSet(ModelViewSet):
request.user.has_perm('agenda.can_see_orga_items')):
self.permission_denied(request)
try:
Item.objects.set_tree(request.data['tree'])
except ValueError as error:
return Response({'detail': str(error)}, status=400)
tree = request.data['tree']
except KeyError as error:
response = Response({'detail': 'Agenda tree is missing.'}, status=400)
else:
return Response({'detail': 'Agenda tree successfully updated.'})
return Response(Item.objects.get_tree())
try:
Item.objects.set_tree(tree)
except ValueError as error:
response = Response({'detail': str(error)}, status=400)
else:
response = Response({'detail': 'Agenda tree successfully updated.'})
else:
# request.method == 'GET'
response = Response(Item.objects.get_tree())
return response
# Views to generate PDFs