| 1 |
from django.shortcuts import render |
| 2 |
|
| 3 |
|
| 4 |
def render_view(request): |
| 5 |
return render( |
| 6 |
request, |
| 7 |
"shortcuts/render_test.html", |
| 8 |
{ |
| 9 |
"foo": "FOO", |
| 10 |
"bar": "BAR", |
| 11 |
}, |
| 12 |
) |
| 13 |
|
| 14 |
|
| 15 |
def render_view_with_multiple_templates(request): |
| 16 |
return render( |
| 17 |
request, |
| 18 |
[ |
| 19 |
"shortcuts/no_such_template.html", |
| 20 |
"shortcuts/render_test.html", |
| 21 |
], |
| 22 |
{ |
| 23 |
"foo": "FOO", |
| 24 |
"bar": "BAR", |
| 25 |
}, |
| 26 |
) |
| 27 |
|
| 28 |
|
| 29 |
def render_view_with_content_type(request): |
| 30 |
return render( |
| 31 |
request, |
| 32 |
"shortcuts/render_test.html", |
| 33 |
{ |
| 34 |
"foo": "FOO", |
| 35 |
"bar": "BAR", |
| 36 |
}, |
| 37 |
content_type="application/x-rendertest", |
| 38 |
) |
| 39 |
|
| 40 |
|
| 41 |
def render_view_with_status(request): |
| 42 |
return render( |
| 43 |
request, |
| 44 |
"shortcuts/render_test.html", |
| 45 |
{ |
| 46 |
"foo": "FOO", |
| 47 |
"bar": "BAR", |
| 48 |
}, |
| 49 |
status=403, |
| 50 |
) |
| 51 |
|
| 52 |
|
| 53 |
def render_view_with_using(request): |
| 54 |
using = request.GET.get("using") |
| 55 |
return render(request, "shortcuts/using.html", using=using) |