[Django]-Expected view to be called with a URL keyword argument named "pk"

53👍

View functions are called with the request and the arguments from the URL. So pass them:

response = view(request, pk=1)

7👍

I encountered similar error when I made a mistake of using get_object method in perform_create. Read why this wrong from documentation

perform_create(self,instance):
      instance = self.get_object()
👤7guyo

Leave a comment