2011-01-20 12:47:47 +08:00
|
|
|
from django.http import HttpResponse
|
|
|
|
from django.shortcuts import get_object_or_404
|
2013-11-04 23:50:14 +08:00
|
|
|
from django.template import loader, Context
|
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):
|
|
|
|
template = loader.get_template_from_string("This is a string-based template")
|
|
|
|
return HttpResponse(template.render(Context({})))
|