2011-01-20 04:47:47 +00:00
|
|
|
from django.http import HttpResponse
|
|
|
|
from django.shortcuts import get_object_or_404
|
2013-11-04 16:50:14 +01:00
|
|
|
from django.template import loader, Context
|
2011-10-13 21:34:56 +00:00
|
|
|
|
|
|
|
from .models import Person
|
|
|
|
|
2011-01-20 04:47:47 +00:00
|
|
|
|
|
|
|
def get_person(request, pk):
|
|
|
|
person = get_object_or_404(Person, pk=pk)
|
2013-07-29 19:19:04 +02:00
|
|
|
return HttpResponse(person.name)
|
2013-11-04 16:50:14 +01:00
|
|
|
|
2013-11-08 09:03:59 -08:00
|
|
|
|
2013-11-04 16:50:14 +01:00
|
|
|
def no_template_used(request):
|
|
|
|
template = loader.get_template_from_string("This is a string-based template")
|
|
|
|
return HttpResponse(template.render(Context({})))
|
2014-05-04 21:29:49 +07:00
|
|
|
|
|
|
|
|
|
|
|
def empty_response(request):
|
|
|
|
return HttpResponse('')
|