views.py 626 Bytes
Newer Older
1
from django import http
2
from django.core.exceptions import PermissionDenied
3 4 5
from django.template import Template
from django.template.response import TemplateResponse

6

7 8 9
def normal_view(request):
    return http.HttpResponse('OK')

10 11 12 13 14 15
def template_response(request):
    return TemplateResponse(request, Template('OK'))

def template_response_error(request):
    return TemplateResponse(request, Template('{%'))

16 17 18 19 20 21 22 23 24 25 26
def not_found(request):
    raise http.Http404()

def server_error(request):
    raise Exception('Error in view')

def null_view(request):
    return None

def permission_denied(request):
    raise PermissionDenied()