mirror of
https://github.com/django/django.git
synced 2024-12-25 02:26:12 +00:00
20 lines
477 B
Python
20 lines
477 B
Python
from django.http import HttpResponse
|
|
from django.shortcuts import get_object_or_404
|
|
from django.template import Context, Template
|
|
|
|
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 = Template("This is a string-based template")
|
|
return HttpResponse(template.render(Context({})))
|
|
|
|
|
|
def empty_response(request):
|
|
return HttpResponse('')
|