Hi, > Le 17 nov. 2016 à 09:10, Ryan Sears <[email protected] > <mailto:[email protected]>> a écrit : > > Hi folks! > > I've got a question on nesting viewsets properly to have different permission > classes/contexts. Any extra eyes would be greatly appreciated, as it's been > open for about a week and I'm not confident that any of the solutions > proposed are the "right" way to accomplish what I'm trying to do! > > http://stackoverflow.com/questions/40455229/nesting-viewset-routes-in-drf > <http://stackoverflow.com/questions/40455229/nesting-viewset-routes-in-drf> > > Cheers, > Ryan
We usually advice not to nested routes. ReST API expose resources. Nesting routes means that you don’t have direct access to those resources which makes things more complex for the client, breaks automated generations and duplicates entry points for the same resource (which is similar to breaking DRY). There are probably other points too. As mentioned on SO, https://github.com/alanjds/drf-nested-routers <https://github.com/alanjds/drf-nested-routers> should do. As you think it’s overkill, you may want to look at the source and take whatever you want if you still want to go in that direction. Regards, Xavier, Linovia. -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
