Skip to content

Fix camelcase -> dasherise issue #92

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
Sep 17, 2015
Merged
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
8 changes: 8 additions & 0 deletions rest_framework_json_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ def format_value(value, format_type=None):
def format_relation_name(value, format_type=None):
if format_type is None:
format_type = getattr(settings, 'JSON_API_FORMAT_RELATION_KEYS', False)

if not format_type:
# let's keep it the way it was
return value

# in case the value is going to be changed, make it underscored first
# because dasherize does not work with a camel cased string
value = inflection.underscore(value)

# format_type will never be None here so we can use format_value
value = format_value(value, format_type)
Expand Down