File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,7 @@ def get_resource_name(context):
6767
6868 resource_name = inflection .pluralize (resource_name .lower ())
6969
70- format_type = getattr (settings , 'JSON_API_FORMAT_KEYS' , False )
71- if format_type == 'dasherize' :
72- resource_name = inflection .dasherize (resource_name )
73- elif format_type == 'camelize' :
74- resource_name = inflection .camelize (resource_name )
75- elif format_type == 'underscore' :
76- resource_name = inflection .underscore (resource_name )
70+ resource_name = format_value (resource_name )
7771
7872 return resource_name
7973
@@ -118,6 +112,16 @@ def format_keys(obj, format_type=None):
118112 return obj
119113
120114
115+ def format_value (value , format_type = None ):
116+ format_type = getattr (settings , 'JSON_API_FORMAT_KEYS' , False )
117+ if format_type == 'dasherize' :
118+ return inflection .dasherize (value )
119+ if format_type == 'camelize' :
120+ return inflection .camelize (value )
121+ if format_type == 'underscore' :
122+ return inflection .underscore (value )
123+
124+
121125def build_json_resource_obj (fields , resource , resource_name ):
122126 resource_data = [
123127 ('type' , resource_name ),
You can’t perform that action at this time.
0 commit comments