from rest_framework import viewsets from rest_framework response impor

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from rest_framework import viewsets
from rest_framework.response import Response
class TalkViewSet(viewsets.ModelViewSet):
queryset = Talk.objects.all()
@detail_route()
def published(self):
talk = self.get_object()
talk.published =True
return Response()