Example #1
0
    def delete(self, request, thread_pk, pk):
        thread = self.get_thread_for_update(request, thread_pk)
        instance = self.get_poll(thread, pk)

        allow_delete_poll(request.user, instance)

        thread.poll.delete()

        thread.has_poll = False
        thread.save()

        return Response({
            'can_start_poll': can_start_poll(request.user, thread),
        })
    def delete(self, request, thread_pk, pk=None):
        thread = self.get_thread(request, thread_pk)
        instance = self.get_poll(thread, pk)

        allow_delete_poll(request.user, instance)

        thread.poll.delete()

        thread.has_poll = False
        thread.save()

        return Response({
            'can_start_poll': can_start_poll(request.user, thread),
        })