writing the final frame routing component drf

Use drf frame routing component

A. Import module

from rest_framework.routers import SimpleRouter

II. Route Object Initialization

router = SimpleRouter()

III. Creating Routing

= Router SimpleRouter ()
 # registration various interfaces routing 
router.register ( ' cars ' , views.CarModelViewSet, base_name = ' CAR ' )

 

Guess you like

Origin www.cnblogs.com/baohanblog/p/12345417.html