Merge pull request #1636 from normanjaeckel/AgendaTree

Fixed agenda tree, fixed #1635.
This commit is contained in:
Oskar Hahn 2015-09-16 14:57:11 +02:00
commit ddafb6682a
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