0

I googled the following question: How can I use the put method in HTML by form?

but I found many answers one of them is (Using PUT method in HTML form) for that, I need to use the put method because I would like to handle the response by Django in Views model so, in Views, there are many different methods to deal with requests like (GET, POST, PUT, and many others).

so, if I decided to use the put method, for example, I should as I understand get the request that has been modified by the PUT method as I believe that this is how Django works.

could anyone help, please? thanks

Abdelhamed Abdin
  • 556
  • 1
  • 6
  • 19

1 Answers1

0

I resolve my issue after I googled many times then I discovered that HTML only accepts two ways: POST and GET methods for handling the requests.

but I got a solution I don't know if it was a good solution or not by using hidden input I named it by "_put" then, I ran the put method into the post method like so:

class TestView(Views):

    def post(self, request):
        if "_put" in request.POST:
            return self.put(request)

    def put(self, request):
        # TODO
Abdelhamed Abdin
  • 556
  • 1
  • 6
  • 19