I am attempting to add to the django server additional functionality upon different host requests.
To do do so, I overridden the ModelViewSet functions with thought to add functionality within those functions.
What I saw is that when setting a breakpoint on retrieve and list (GET requests), the debugger stopped. But when trying to break on create or update (POST requests) the debugger didn't break.
How to resolve this?
One more detail (which is actually the answer to the question), is that I used the admin interface to perform the create and update (unlike the retrieve and list which I used the REST framework).
class GraphViewSet(ModelViewSet):
queryset = Graph.objects.all()
serializer_class = GraphSerializer
def create(self, request, *args, **kwargs):
response = super(ModelViewSet, self).create(request, args, kwargs)
return response
def retrieve(self, request, *args, **kwargs):
response = super(ModelViewSet, self).retrieve(request, args, kwargs)
return response
def update(self, request, *args, **kwargs):
response = super(ModelViewSet, self).update(request, args, kwargs)
return response
def partial_update(self, request, *args, **kwargs):
response = super(ModelViewSet, self).partial_update(request, args, kwargs)
return response
def destroy(self, request, *args, **kwargs):
response = super(ModelViewSet, self).destroy(request, args, kwargs)
return response
def list(self, request, *args, **kwargs):
response = super(ModelViewSet, self).list(request, args, kwargs)
return response
def post(self, request, *args, **kwargs):
response = super(ModelViewSet, self).post(request, args, kwargs)
return response
Python 3.6.3 Django 1.11.7 djangorestframework 9.0.1
Appreciate also any additional possible solutions for adding functionality on the server side to the different client requests.