I've got two models, one of a box and one of box comment:
class BoxViewSet(viewsets.ModelViewSet):
queryset = Box.objects.all()
permission_classes = IsAuthenticated,
serializer_class = BoxSerializer
class BoxCommentViewSet(viewsets.ModelViewSet):
model = BoxComment
serializer_class = CommentSerializer
permission_classes = IsAuthenticated
def get_queryset(self):
# this should return a queryset that filters based on the
# box in the route
return BoxComment.objects.all()
If I've set up a router to make Boxes available at /boxes/
and specific boxes available at /boxes/{id}/
using
router.register(r'boxes', feed.views.BoxViewSet)
is it possible to make comments available at /boxes/{id}/comments/
? Or should I just set up a separate route and use GET/POST parameters to refer to specific boxes?