How can viewsets and routers help you with Django REST Framework?
If you looked at the documentation for ad hoc viewset methods, you might be confused by the use of
@detail_route. REST framework offers two decorators for ad hoc methods,
@list_route might seem to make more sense because you are, in fact, returning a list. The main difference between the two decorators, however, is that
@detail_route is designed to receive a primary key argument. You need the primary key of the current course to be able to filter the reviews, so you'd use
@detail_route instead of
Speaking of documentation:
You need to sign up for Treehouse in order to download course files.Sign up