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 // set changed agenda tree
$scope.treeOptions = { $scope.treeOptions = {
dropped: function() { 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')): request.user.has_perm('agenda.can_see_orga_items')):
self.permission_denied(request) self.permission_denied(request)
try: try:
Item.objects.set_tree(request.data['tree']) tree = request.data['tree']
except ValueError as error: except KeyError as error:
return Response({'detail': str(error)}, status=400) response = Response({'detail': 'Agenda tree is missing.'}, status=400)
else: else:
return Response({'detail': 'Agenda tree successfully updated.'}) try:
return Response(Item.objects.get_tree()) 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 # Views to generate PDFs