Skip to content

Commit

Permalink
fix(api): Ensure queryset filters to actual item if pk is defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Nov 27, 2024
1 parent 7a5c55a commit 9667085
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/api/viewsets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,16 @@ def get_queryset(self):

if not self.queryset:

self.queryset = self.model.objects.all()

queryset = self.model.objects.all()

if 'pk' in self.kwargs:

if self.kwargs['pk']:

queryset = queryset.filter( pk = int( self.kwargs['pk'] ) )

self.queryset = queryset

return self.queryset


Expand Down

0 comments on commit 9667085

Please sign in to comment.