I was wondering how can I limit the queryset to the data associated with the current user. Here is my view:
class TradingGroupList(generics.ListAPIView):
queryset = Tradegroup.objects.all()
serializer_class = TradeGroupSerializer
name = 'tradegroup-list'
I would write somethinng like queryset = Tradegroup.objects.filter(owner=self.request.user) in native django, but was wondering how I could achieve this here.
This should actually work by overriding the get_queryset method. Simply add this method to your ListAPIView and it should work.
I hope this works for you. If you have a problem with it just give me a comment.