[Fixed]-Django Rest queryset filter by url parameter

30👍

You can access the url parameter in your view with self.kwargs['parameter_name'] ( http://www.django-rest-framework.org/api-guide/filtering#filtering-against-the-url ). So the simplest solution would be

def get_queryset(self):
    return Attendee.objects.filter(event=self.kwargs['pk'])
👤Zorba

Leave a comment