def reorder_sections(self, request, pk=None): document = get_object_or_404(Document, pk=pk) #self.check_object_permissions(request, _course) myplaylist = request.DATA['playlist'] newplaylist = playlist.is_valid(myplaylist, document.playlist) if newplaylist is not False: document.playlist = newplaylist document.save() return Response(document.to_dict()) else: content = "Given order data does not have the correct format" return Response(content, status.HTTP_404_NOT_FOUND)
def reorder_concepts(self, request, pk=None): group = get_object_or_404(Group, pk=pk) self.check_object_permissions(request=request, obj=group.course) myplaylist = request.DATA['playlist'] newplaylist = playlist.is_valid(myplaylist, group.playlist) if newplaylist is not False: group.playlist = newplaylist group.save() return Response(group.playlist) else: content = "Given order data does not have the correct format" return Response(content, status.HTTP_404_NOT_FOUND)
def reorder_groups(self, request, pk=None): _course = get_object_or_404(Course, pk=pk) self.check_object_permissions(request, _course) myplaylist = request.DATA['playlist'] newplaylist = playlist.is_valid(myplaylist, _course.playlist) if newplaylist is not False: _course.playlist = newplaylist _course.save() return Response(_course.playlist) else: content = "Given order data does not have the correct format" return Response(content, status.HTTP_404_NOT_FOUND)
def reorder_pages(self, request, pk=None): _course = get_object_or_404(Course, pk=pk) self.check_object_permissions(request, _course) print request.DATA myplaylist = request.DATA['playlist'] print myplaylist newplaylist = playlist.is_valid(myplaylist, _course.page_playlist) if newplaylist is not False: _course.page_playlist = newplaylist _course.save() return Response(_course.page_playlist) else: content = "Given order data does not have the correct format" return Response(content, status.HTTP_404_NOT_FOUND)