I have a old endpoint with a URL like this:
url(r'^vehicles/([^/]{1,50})/trips/data/?$', 'vehicle_trip_data'),
which was mapped to my function based view.
I am now refactoring the works to work with drf-nested-routers.
What I know is, that I can route to custom methods. Like when I have the former Endpoint url(r'^vehicles/([^/]{1,50})/trips/?$', 'vehicle_trips_view')
I am just adding a method trips
like this:
@detail_route(methods=['GET'], permission_classes=[IsAuthenticated, VehiclePermissions])
def trips(self, request, pk=None):
I obviously can't just name the method trips/data. So is there a way how I can make a detailed route for the first example!?
Try specifying
trips/data
inurl_path
parameter.