1
0
mirror of https://github.com/django/django.git synced 2024-12-28 12:06:22 +00:00
django/tests/test_utils/views.py
Loic Bistuer 942556df2f Fixed #22572 -- override_settings(ROOT_URLCONF) didn't clear urlresolvers._urlconfs.
Thanks Anubhav Joshi and Tim Graham for the reviews.
2014-05-05 19:29:27 +07:00

20 lines
498 B
Python

from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.template import loader, Context
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({})))
def empty_response(request):
return HttpResponse('')