title: Possible to have a method on an APIView called from a url
body: <p>In Django Rest Framework is it possible to have a custom method in an <code>APIView</code> class be called similar to how <code>.get()</code> or <code>.post()</code> would be called.</p>
  
  <p>I know it's possible with routers using the <code>@action()</code> or <code>@link()</code> decorators, I'm trying to figure out if you can do something similar to an <code>APIView</code> but have it so I can set the method to whatever url I want.</p>
  
  <p>I've tried decorating the class with <code>@action()</code> and <code>@api_view()</code> but nothing seems to have worked.</p>
  
  <p>I'm not exactly sure what I should put in the url for an endpoint to actually call the method in the class. Would I use <code>CartAPIView.clear.as_view()</code>, <code>CartAPIView.clear</code>, or <code>CartAPIView.clear()</code>. I've tried different combinations of calls to <code>CartAPIView</code> but nothing has worked.</p>
  
  <p>Here's an example of what I'm trying to do:</p>
  
  <pre><code># views.py
  class CartAPIView(APIView):
      @api_view(['POST'])
      def clear(self, request):
          """Clear the users cart."""
          queryset = Cart.objects.get(user=request.user)
  
          queryset.clear_cart()
  
          serializer = CartSerializer(queryset)
  
          return Response(serializer.data, status=status.HTTP_200_OK)
  
  # urls.py
  urlpatterns = patterns('app.views',
      ....
      url(r'^cart/clear/$', CartAPIView.clear.as_view(), name='clear_cart_api'),
      ....
  )
  </code></pre>
  
  <p>Any help would be appreciated.</p>