ViewSets & Routers
REST framework includes an abstraction for dealing with ViewSets
, that allows the developer to concentrate on modeling the state and interactions of the API, and leave the URL construction to be handled automatically, based on common conventions.
ViewSet
classes are almost the same thing as View
classes, except that they provide operations such as read
, or update
, and not method handlers such as get
or put
.
A ViewSet
class is only bound to a set of method handlers at the last moment, when it is instantiated into a set of views, typically by using a Router
class which handles the complexities of defining the URL conf for you.
当前内容版权归 Django REST 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Django REST .