Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP methods for the Django Rest Framework Viewset

Tags:

django

I'm working on django rest framework viewset and want to know which HTTP methods map to the functions:

1.list()

2.create()

3.retrieve()

4.update()

5.partial_update()

6.destroy()

I have searched a lot but I didn't got the specific answer to my question.

So I just want to know which http method maps all the above listed functions

thanks in advance!!


1 Answers

You can see Django Rest Framework code and see in routers.py file methods mapping, e.g. in SimpleRouter:

  • GET: list() and retrieve()
  • POST: create()
  • PUT: update()
  • PATCH: partial_update()
  • DELETE: destroy()
like image 150
Yevhenii M. Avatar answered Aug 08 '26 21:08

Yevhenii M.