Skip to content

Commit 00675cd

Browse files
committed
spells view prefetching now pulls depth data from query params instead of Meta
1 parent a4d5a35 commit 00675cd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

api_v2/views/spell.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class SpellViewSet(viewsets.ReadOnlyModelViewSet):
4040

4141
def get_queryset(self):
4242
queryset = models.Spell.objects.all().order_by('pk')
43-
depth = self.get_serializer().Meta.depth
43+
44+
# Retrieve depth from query params, defaulting to 0 if not provided
45+
depth = int(self.request.query_params.get("depth", 0))
46+
4447
queryset = SpellViewSet.setup_eager_loading(queryset, depth)
4548
return queryset
4649

0 commit comments

Comments
 (0)