@link decorator in django rest framework as a list controller

Viewed 2926

so i want to filter all the sales invoices using url .. e.g.

/api/v1/invoice/sales/

i think the best way to do this is by using @link method in the viewset. here is my code ..

@link()
def sales(self, request, pk):
    qs = Invoice.objects.filter(is_sales=True)
    serializer = InvoiceSerializer(qs)
    return Response(serializer.data)

but when i go to '/api/v1/invoice/sales/', and use breakpoints, the script doesn't stop at any point..

what am i doing wrong here?

//mouse

1 Answers
Related