diff options
| author | Unai Zalakain <unai@gisa-elkartea.org> | 2013-11-04 16:50:14 +0100 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-11-08 17:10:37 +0100 |
| commit | 72f63bd24d44b5a4f24ad8fa27ebba96d9a507d8 (patch) | |
| tree | 03ad4a7dd8a6be5975da0478c67ba0a6409ba482 /tests/test_utils/views.py | |
| parent | bc21e9c0d9253f9d49a0063830a645d1c724c696 (diff) | |
Fixed #17529 -- get_template_from_string default arguments break
``get_template_from_string`` default arguments were breaking
``assertTemplateUsed``. The solution has been to return only the names of the
templates with a ``name`` attribute distinct of ``None``. The default ``name``
kwarg of ``Template`` has been changed to ``None``, more pythonic than ``'<Unknown
Template>'``.
Diffstat (limited to 'tests/test_utils/views.py')
| -rw-r--r-- | tests/test_utils/views.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_utils/views.py b/tests/test_utils/views.py index 77e598b72c..a804bb9ae3 100644 --- a/tests/test_utils/views.py +++ b/tests/test_utils/views.py @@ -1,5 +1,6 @@ from django.http import HttpResponse from django.shortcuts import get_object_or_404 +from django.template import loader, Context from .models import Person @@ -7,3 +8,7 @@ from .models import Person def get_person(request, pk): person = get_object_or_404(Person, pk=pk) return HttpResponse(person.name) + +def no_template_used(request): + template = loader.get_template_from_string("This is a string-based template") + return HttpResponse(template.render(Context({}))) |
