aboutsummaryrefslogtreecommitdiffstats
path: root/tests/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/views.py')
-rw-r--r--tests/views.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/views.py b/tests/views.py
index 8b51706..5bafc97 100644
--- a/tests/views.py
+++ b/tests/views.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
from django.contrib.auth.models import User
from django.http import HttpResponse
+from django.shortcuts import render
from django.utils import six
@@ -12,9 +13,15 @@ def execute_sql(request):
return HttpResponse()
+def non_ascii_context(request):
+ class NonAsciiRepr(object):
+ def __repr__(self):
+ return 'nôt åscíì' if six.PY3 else 'nôt åscíì'.encode('utf-8')
+ return render(request, 'basic.html', {'title': NonAsciiRepr()})
+
+
def regular_view(request, title):
- content = '<html><head><title>%s</title></head><body></body></html>' % title
- return HttpResponse(content)
+ return render(request, 'basic.html', {'title': title})
def resolving_view(request, arg1, arg2):
@@ -26,4 +33,4 @@ def set_session(request):
request.session['où'] = 'où'
if not six.PY3:
request.session['là'.encode('utf-8')] = 'là'.encode('utf-8')
- return HttpResponse('<html><head></head><body></body></html>')
+ return render(request, 'basic.html')