Skip to content
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

fix get_template_context #9212

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions docs/topics/browsable-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ To quickly add authentication to the browesable api, add a routes named `"login"

```python
urlpatterns = [
# ...
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework"))
...,
url(r"^api-auth/", include("rest_framework.urls", namespace="rest_framework")),
]
```

Expand Down
2 changes: 2 additions & 0 deletions rest_framework/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ def resolve_template(self, template_names):

def get_template_context(self, data, renderer_context):
response = renderer_context['response']
if isinstance(data, list):
return {'details': data, 'status_code': response.status_code}
if response.exception:
data['status_code'] = response.status_code
return data
Expand Down
Loading