Reputation: 4090
Iam trying to implement the web api for shifts , here ShiftsViewSet is my
api view , while running this project im trying to filter according to id , but its showing error ,
ShiftsViewSet' should either include a queryset
attribute, or override the get_queryset()
method ,
can any one help me to do solve this problem,
thanks in adavance.
Upvotes: 1
Views: 1232
Reputation: 1164
Try this:
def list(self, request, *args, **kwargs):
id = request.QUERY_PARAMS.get('id')
queryset = Shift.objects.filter(pk=id)
...
Upvotes: 1