title: Custom Api function not working during Postman testing
body: <p>Working on API's so I created a custom function to create and delete a ratings, when running tests on postman to check it's functionality does not seem to work</p>
  
  <p><code>ERROR MESSAGE: User matching query does not exist</code></p>
  
  <p>could this be an error on my code or I am not using postman properly?</p>
  
  <p>Below is the code of the function</p>
  
  <pre><code> @action(detail=True, methods=['POST'])
   def rate_movie(self, request, pk=None):
  
      if 'stars' in request.data:
  
          movie = Movie.objects.get(id=pk)
          user = User.objects.get(id=1)
          stars = request.data['stars']
  
          try:
              rating = Rating.objects.get(user=user.id, movie=movie.id)
              rating.stars = stars
              rating.save()
              serializer = RatingSerializer
              response = {'message': 'Rating Updated', 'results': serializer.data}
              return Response(response, status=HTTP_200_OK)
  
          except:
              rating = Rating.objects.create(user=user, movie=movie, stars=stars)
              serializer = RatingSerializer
              response = {'message': 'Rating Created', 'results': serializer.data}
              return Response(response, status=HTTP_200_OK)
  
      else:
          response = {'message':'Stars not selected for rating'}
          return Response(response, status=HTTP_400_bad_request)
  </code></pre>
  
  <p>Here is also a picture of sample request that I was trying when I wanted to test my function and also the error at which I am getting.</p>
  
  <p><a href="https://i.stack.imgur.com/lwBua.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lwBua.jpg" alt="enter image description here"></a></p>