示例#1
0
文件: views.py 项目: kartikshah1/Test
 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)
示例#2
0
文件: views.py 项目: kartikshah1/Test
 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)
示例#3
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)
示例#4
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)
示例#5
0
文件: views.py 项目: kartikshah1/Test
 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)
示例#6
0
文件: group.py 项目: kartikshah1/Test
 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)
示例#7
0
文件: views.py 项目: kartikshah1/Test
 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)
示例#8
0
文件: group.py 项目: kartikshah1/Test
 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)