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):
|
|
|
|
return render(request, 'shortcuts/render_test.html', {
|
|
|
|
'foo': 'FOO',
|
|
|
|
'bar': 'BAR',
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2015-01-03 18:28:15 +00: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-22 16:52:12 +00: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-26 20:57:10 +00:00
|
|
|
def render_view_with_using(request):
|
|
|
|
using = request.GET.get('using')
|
|
|
|
return render(request, 'shortcuts/using.html', using=using)
|