drf url Construction Method and Framework -http

A basic http method
A query method http: get
2 query requirements
1 All inquiries url connection: / query /
Routing connection: query /
2 connected to a single query url: / query / + id + '/'
Routing connection: query / (P <pk> \ d +?) / $
You can only build a single query by the primary key
Two Delete
Remove a single connection url: / delete / + id + '/' correspond Method http: delete
Routing connection: query / (P <pk> \ d +?) / $
2 bulk deletion
http method: post
url routing links are all connected and / query /
Can only be constructed by deleting a single primary key
For batch deletion construct post method, and then the rear end of the mass delete operation or by custom orm
Three insert http method: post
url connection: / insert /
Four update
A total update connection url: / update / + id + '/' correspond Method http: update
Routing connections update / (? P <pk> \ d +) / $
2 corresponds to partial update method http: patch
drf update method only a single data for the user is required to customize the method for updating or with post batch
Five summary
1 according to the query update, and delete a single statement are dependent on the primary key ID
2 For batch delete temporary update request only by post and then implement custom processing, or delete, and update your own definition of class
3 for transmitting distal vue form data requires construction of form data, remember
The importance of realize 4
level one
A query (and all single) two deleted (single) three updates (all) four insert
Second floor
A deletion (more than) two updates (section)
the third floor
An update (more than) a second query (paging)

Guess you like

Origin www.cnblogs.com/danhuangpai/p/12630362.html