Skip to content

Commit 0e0f0b5

Browse files
committed
Add underscore inflection for included_resources in AutoPrefetchMixin
1 parent 4f596d7 commit 0e0f0b5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rest_framework_json_api/views.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from collections.abc import Iterable
22

3+
import inflection
34
from django.core.exceptions import ImproperlyConfigured
45
from django.db.models import Model
56
from django.db.models.fields.related_descriptors import (
@@ -86,6 +87,9 @@ def get_queryset(self, *args, **kwargs):
8687
included_resources = get_included_resources(
8788
self.request, self.get_serializer_class()
8889
)
90+
included_resources = [
91+
inflection.underscore(value) for value in included_resources
92+
]
8993

9094
for included in included_resources + ["__all__"]:
9195
# If include was not defined, trying to resolve it automatically

0 commit comments

Comments
 (0)