With Django Rest Framework, how can I grab the sub-objects of a specific entity? -
if want to, say, grab of questions of survey 5, “restful” url “http://domain.com/api/survey/5/question/“.
does drf provide such wouldn’t have override get_queryset()
, manually grab survey id out of url , manually filter down question
queryset?
it seems built in drf such wouldn’t need re-invent wheel each time wanted grab sub objects of specific object, i'm not finding far...
i'm using drf 3.
a co-worker pointed me this: https://github.com/alanjds/drf-nested-routers, existence of hints such functionality isn't (yet) built drf.
after testing around little bit, , appears easy enough use.
Comments
Post a Comment