Skip to content

Convert include queries back to snake case #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rest_framework_json_api/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import copy
from collections import OrderedDict

import inflection
from django.utils import six, encoding
from rest_framework import relations
from rest_framework import renderers
Expand Down Expand Up @@ -237,6 +238,7 @@ def extract_included(fields, resource, resource_instance, included_resources):
context = current_serializer.context
included_serializers = utils.get_included_serializers(current_serializer)
included_resources = copy.copy(included_resources)
included_resources = [inflection.underscore(value) for value in included_resources]

for field_name, field in six.iteritems(fields):
# Skip URL field
Expand Down
3 changes: 2 additions & 1 deletion rest_framework_json_api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import inflection
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import ParseError
from rest_framework.serializers import *
Expand Down Expand Up @@ -75,7 +76,7 @@ def validate_path(serializer_class, field_path, path):
serializers = get_included_serializers(serializer_class)
if serializers is None:
raise ParseError('This endpoint does not support the include parameter')
this_field_name = field_path[0]
this_field_name = inflection.underscore(field_path[0])
this_included_serializer = serializers.get(this_field_name)
if this_included_serializer is None:
raise ParseError(
Expand Down