from django.http import HttpResponse, HttpResponseNotAllowed from django.utils.decorators import method_decorator from django.views import View from django.views.decorators.csrf import csrf_exempt @csrf_exempt def index(request): """index page""" method = request.method if method == "GET": return HttpResponseNotAllowed(["POST"]) elif method == "POST": return HttpResponse(f"You has got this page by POST method.") @method_decorator(csrf_exempt, name="dispatch") class IndexView(View): template = """\
You has got this page by {method} method, the following steps are:
{content}