[Fixed]-Django upload file : test request == POST or use decorator?

1👍

The decorators in django.views.decorators.http can be used to restrict access to views based on the request method. These decorators will return a django.http.HttpResponseNotAllowed if the conditions are not met.

View decorators

As for 2, if request.method == 'POST' is perfectly fine and used in function based views.

👤zxzak

Leave a comment