Example #1
0
 def destroy(self, request, pk=None, *args):
     document = get_object_or_404(Document, pk=pk)
     _course = Course.objects.filter(pages__pk=pk)
     if len(_course) > 0:
         _course = _course[0]
         _course.page_playlist = playlist.delete(_course.page_playlist,
                                                 pk=pk)
         _course.save()
     return super(DocumentViewSet, self).destroy(request, pk, *args)
Example #2
0
 def destroy(self, request, pk=None):
     """
         Delete a Concept if owned by user and in playlist of its group
     """
     concept = get_object_or_404(Concept, pk=pk)
     group = concept.group
     new_playlist = playlist.delete(group.playlist, pk=pk)
     if not new_playlist:
         return Response({
             "detail": "Object not found in your Group"
             }, status.HTTP_404_NOT_FOUND)
     group.playlist = new_playlist
     group.save()
     return super(ConceptViewSet, self).destroy(request, pk)
Example #3
0
 def destroy(self, request, pk=None, *args):
     group = get_object_or_404(Group, pk=pk)
     _course = group.course
     _course.playlist = playlist.delete(_course.playlist, pk=pk)
     _course.save()
     return super(GroupViewSet, self).destroy(request, pk)
Example #4
0
 def destroy(self, request, pk=None, *args):
     section = get_object_or_404(Section, pk=pk)
     document = section.document
     document.playlist = playlist.delete(document.playlist, pk=pk)
     document.save()
     return super(SectionViewSet, self).destroy(request, pk, *args)