2011-01-20 12:47:47 +08:00
|
|
|
from django.http import HttpResponse
|
|
|
|
from django.shortcuts import get_object_or_404
|
2014-10-31 18:38:53 +08:00
|
|
|
from django.template import Context, Template
|
2011-10-14 05:34:56 +08:00
|
|
|
|
|
|
|
from .models import Person
|
|
|
|
|
2011-01-20 12:47:47 +08:00
|
|
|
|
|
|
|
def get_person(request, pk):
|
|
|
|
person = get_object_or_404(Person, pk=pk)
|
2013-07-30 01:19:04 +08:00
|
|
|
return HttpResponse(person.name)
|
2013-11-04 23:50:14 +08:00
|
|
|
|
2013-11-09 01:03:59 +08:00
|
|
|
|
2013-11-04 23:50:14 +08:00
|
|
|
def no_template_used(request):
|
2014-10-31 18:38:53 +08:00
|
|
|
template = Template("This is a string-based template")
|
2013-11-04 23:50:14 +08:00
|
|
|
return HttpResponse(template.render(Context({})))
|
2014-05-04 22:29:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
def empty_response(request):
|
2019-02-10 05:27:32 +08:00
|
|
|
return HttpResponse()
|