Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Fix errors format in RelationshipView.
  • Loading branch information
amw committed Oct 11, 2016
commit 0302faba3374ccaed332a52b53c28d201da81f77
14 changes: 7 additions & 7 deletions rest_framework_json_api/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,24 +419,24 @@ def render(self, data, accepted_media_type=None, renderer_context=None):
view = renderer_context.get("view", None)
request = renderer_context.get("request", None)

# Get the resource name.
resource_name = utils.get_resource_name(renderer_context)

# If this is an error response, skip the rest.
if resource_name == 'errors':
return self.render_errors(data, accepted_media_type, renderer_context)

from rest_framework_json_api.views import RelationshipView
if isinstance(view, RelationshipView):
return self.render_relationship_view(data, accepted_media_type, renderer_context)

# Get the resource name.
resource_name = utils.get_resource_name(renderer_context)

# If `resource_name` is set to None then render default as the dev
# wants to build the output format manually.
if resource_name is None or resource_name is False:
return super(JSONRenderer, self).render(
data, accepted_media_type, renderer_context
)

# If this is an error response, skip the rest.
if resource_name == 'errors':
return self.render_errors(data, accepted_media_type, renderer_context)

json_api_data = data
json_api_included = list()
# initialize json_api_meta with pagination meta or an empty dict
Expand Down