Skip to content

Commit 28833bf

Browse files
committed
Merge pull request #92 from adfinis-sygroup/develop
Fix camelcase -> dasherise issue
2 parents 8d4131b + c262e77 commit 28833bf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rest_framework_json_api/utils.py

+8
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ def format_value(value, format_type=None):
132132
def format_relation_name(value, format_type=None):
133133
if format_type is None:
134134
format_type = getattr(settings, 'JSON_API_FORMAT_RELATION_KEYS', False)
135+
136+
if not format_type:
137+
# let's keep it the way it was
138+
return value
139+
140+
# in case the value is going to be changed, make it underscored first
141+
# because dasherize does not work with a camel cased string
142+
value = inflection.underscore(value)
135143

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

0 commit comments

Comments
 (0)