Skip to content

Commit f22c968

Browse files
committed
Format the root API links as per the spec. Closes #58
1 parent d51eea6 commit f22c968

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

rest_framework_json_api/renderers.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ def render(self, data, accepted_media_type=None, renderer_context=None):
9595
if isinstance(data, dict) and data.get('links'):
9696
render_data['links'] = data.get('links')
9797

98-
render_data['data'] = json_api_data
98+
# format the api root link list
99+
if view.__class__ and view.__class__.__name__ == 'APIRoot':
100+
render_data['data'] = None
101+
render_data['links'] = json_api_data
102+
else:
103+
render_data['data'] = json_api_data
99104

100105
if len(json_api_included) > 0:
101106
# Iterate through compound documents to remove duplicates

0 commit comments

Comments
 (0)