Skip to content

Commit b039a44

Browse files
committed
Fix resource allocation queries returning all resources
1 parent 9c5a593 commit b039a44

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

coral_credits/api/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ class CreditAllocationViewSet(viewsets.ModelViewSet):
2323

2424

2525
class CreditAllocationResourceViewSet(viewsets.ModelViewSet):
26-
queryset = models.CreditAllocationResource.objects.all()
2726
serializer_class = serializers.CreditAllocationResourceSerializer
2827
permission_classes = [permissions.IsAuthenticated]
2928

29+
def get_queryset(self):
30+
return models.CreditAllocationResource.objects.filter(allocation__pk=self.kwargs["allocation_pk"])
31+
3032
def _create_update_credit_allocations(self, request, allocation_pk):
3133
"""Allocate credits to a dictionary of resource classes.
3234

0 commit comments

Comments
 (0)