API: leave notes on get_object's future

This commit is contained in:
Klaas van Schelven
2025-09-18 13:21:53 +02:00
parent 3f6e062bed
commit 4d3756f621
4 changed files with 4 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ class ProjectViewSet(AtomicRequestMixin, ExpandViewSetMixin, viewsets.ModelViewS
def get_object(self):
# Pure PK lookup (bypass filter_queryset)
# NOTE: alternatively, we just complain hard when a filter is applied to a detail view.
queryset = self.get_queryset()
lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
obj = get_object_or_404(queryset, **{self.lookup_field: self.kwargs[lookup_url_kwarg]})