2018-12-28 00:23:09 +00:00
|
|
|
from django.shortcuts import render
|
2014-11-22 08:22:38 +00:00
|
|
|
|
|
|
|
|
2014-11-22 16:52:12 +00:00
|
|
|
def render_view(request):
|
2022-02-03 19:24:19 +00:00
|
|
|
return render(
|
|
|
|
request,
|
|
|
|
"shortcuts/render_test.html",
|
|
|
|
{
|
|
|
|
"foo": "FOO",
|
|
|
|
"bar": "BAR",
|
|
|
|
},
|
|
|
|
)
|
2014-11-22 16:52:12 +00:00
|
|
|
|
|
|
|
|
2015-01-03 18:28:15 +00:00
|
|
|
def render_view_with_multiple_templates(request):
|
2022-02-03 19:24:19 +00:00
|
|
|
return render(
|
|
|
|
request,
|
|
|
|
[
|
|
|
|
"shortcuts/no_such_template.html",
|
|
|
|
"shortcuts/render_test.html",
|
|
|
|
],
|
|
|
|
{
|
|
|
|
"foo": "FOO",
|
|
|
|
"bar": "BAR",
|
|
|
|
},
|
|
|
|
)
|
2015-01-03 18:28:15 +00:00
|
|
|
|
|
|
|
|
2014-11-22 16:52:12 +00:00
|
|
|
def render_view_with_content_type(request):
|
2022-02-03 19:24:19 +00:00
|
|
|
return render(
|
|
|
|
request,
|
|
|
|
"shortcuts/render_test.html",
|
|
|
|
{
|
|
|
|
"foo": "FOO",
|
|
|
|
"bar": "BAR",
|
|
|
|
},
|
|
|
|
content_type="application/x-rendertest",
|
|
|
|
)
|
2014-11-22 16:52:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
def render_view_with_status(request):
|
2022-02-03 19:24:19 +00:00
|
|
|
return render(
|
|
|
|
request,
|
|
|
|
"shortcuts/render_test.html",
|
|
|
|
{
|
|
|
|
"foo": "FOO",
|
|
|
|
"bar": "BAR",
|
|
|
|
},
|
|
|
|
status=403,
|
|
|
|
)
|
2014-11-22 16:52:12 +00:00
|
|
|
|
|
|
|
|
2015-01-26 20:57:10 +00:00
|
|
|
def render_view_with_using(request):
|
2022-02-03 19:24:19 +00:00
|
|
|
using = request.GET.get("using")
|
|
|
|
return render(request, "shortcuts/using.html", using=using)
|