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