Skip to content

Instantly share code, notes, and snippets.

@jacobh
Created July 29, 2014 04:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobh/2ff324795c80bb4173ab to your computer and use it in GitHub Desktop.
Save jacobh/2ff324795c80bb4173ab to your computer and use it in GitHub Desktop.

Current code:

class PaymentSummaryViewSet(viewsets.ModelViewSet):
    queryset = PaymentSummary.objects.all()
    serializer_class = PaymentSummarySerializer
 
    @action()
    def send(self, request, pk=None):
        # code to send individual payment summary

collection_action suggestion:

class PaymentSummaryViewSet(viewsets.ModelViewSet):
    queryset = PaymentSummary.objects.all()
    serializer_class = PaymentSummarySerializer
 
    @action()
    def send(self, request, pk=None):
        # code to send individual payment summary
        
    @collection_action()
    def send_pending(self, request):
        # will be called when hitting
        # /api/payment-summary/send_pending/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment