1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Deprecated some arguments of django.shortcuts.render(_to_response).

dictionary and context_instance and superseded by context.

Refactored tests that relied context_instance with more modern idioms.
This commit is contained in:
Aymeric Augustin
2014-12-14 10:17:18 +01:00
parent a0141f9eac
commit fdbfc98003
12 changed files with 137 additions and 92 deletions

View File

@@ -95,6 +95,8 @@ you can document in your view function docstrings include:
For example::
from django.shortcuts import render
from myapp.models import MyModel
def my_view(request, slug):
@@ -103,8 +105,6 @@ For example::
**Context**
``RequestContext``
``mymodel``
An instance of :model:`myapp.MyModel`.
@@ -113,10 +113,8 @@ For example::
:template:`myapp/my_template.html`
"""
return render_to_response('myapp/my_template.html', {
'mymodel': MyModel.objects.get(slug=slug)
}, context_instance=RequestContext(request))
context = {'mymodel': MyModel.objects.get(slug=slug)}
return render(request, 'myapp/my_template.html', context)
Template tags and filters reference
===================================