diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2010-12-22 04:54:10 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2010-12-22 04:54:10 +0000 |
| commit | 0fef92f6f0d064cdce4e8722fd9fe27ed451bb9b (patch) | |
| tree | 047694c33e157657cc1e300aa093ba91fbee541c /docs | |
| parent | 6e75ee2b3289b7d7e8192c62d665cd08d3819360 (diff) | |
Fixed #14936 -- Tweaked the new render shortcut to reflect non-legacy arguments. Thanks to adamv for the report.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15020 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/topics/http/shortcuts.txt | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt index 1d3e89ea83..ebe72324cb 100644 --- a/docs/topics/http/shortcuts.txt +++ b/docs/topics/http/shortcuts.txt @@ -15,7 +15,7 @@ introduce controlled coupling for convenience's sake. ``render`` ========== -.. function:: render(request, template[, dictionary][, context_instance][, mimetype]) +.. function:: render(request, template[, dictionary][, context_instance][, content_type][, status]) .. versionadded:: 1.3 @@ -48,22 +48,25 @@ Optional arguments will be rendered with a ``RequestContext`` instance (filled with values from ``request`` and ```dictionary``). -``mimetype`` +``content_type`` The MIME type to use for the resulting document. Defaults to the value of the :setting:`DEFAULT_CONTENT_TYPE` setting. +``status`` + The status code for the response. Defaults to ``200``. + Example ------- The following example renders the template ``myapp/index.html`` with the MIME type ``application/xhtml+xml``:: - from django.shortcuts import render_to_response + from django.shortcuts import render def my_view(request): # View code here... - return render_to_response('myapp/index.html', {"foo": "bar"}, - mimetype="application/xhtml+xml") + return render(request, 'myapp/index.html', {"foo": "bar"}, + content_type="application/xhtml+xml") This example is equivalent to:: @@ -75,7 +78,7 @@ This example is equivalent to:: t = loader.get_template('myapp/template.html') c = RequestContext(request, {'foo': 'bar'}) return HttpResponse(t.render(c), - mimetype="application/xhtml+xml") + content_type="application/xhtml+xml") ``render_to_response`` |
