Answers for "django view set http methods"

1

require http method django view

from django.views.decorators.http import require_http_methods

@require_http_methods(["GET", "POST"])
def my_view(request):
    # I can assume now that only GET or POST requests make it this far
    # ...
    pass
Posted by: Guest on October-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language