@@ -99,6 +99,13 @@ def url_path_detail(self, request, *args, **kwargs):
9999 kwarg = self .kwargs .get ('kwarg' , '' )
100100 return Response ({'pk' : pk , 'kwarg' : kwarg })
101101
102+ @action (detail = True , url_path = 'detail/<int:kwarg>/detail/<int:param>' )
103+ def url_path_detail_multiple_params (self , request , * args , ** kwargs ):
104+ pk = self .kwargs .get ('pk' , '' )
105+ kwarg = self .kwargs .get ('kwarg' , '' )
106+ param = self .kwargs .get ('param' , '' )
107+ return Response ({'pk' : pk , 'kwarg' : kwarg , 'param' : param })
108+
102109
103110notes_router = SimpleRouter ()
104111notes_router .register (r'notes' , NoteViewSet )
@@ -561,6 +568,18 @@ def test_detail_extra_action(self):
561568 assert response .status_code == 200
562569 assert json .loads (response .content .decode ()) == {'pk' : pk , 'kwarg' : kwarg }
563570
571+ def test_detail_extra_other_action (self ):
572+ # this to assure that ambiguous patterns are interpreted correctly
573+ # using the `path` converters this URL is recognized to match the pattern
574+ # of `UrlPathViewSet.url_path_detail` when it should match
575+ # `UrlPathViewSet.url_path_detail_multiple_params`
576+ pk = '1'
577+ kwarg = 1234
578+ param = 2
579+ response = self .client .get ('/path/1/detail/1234/detail/2/' )
580+ assert response .status_code == 200
581+ assert json .loads (response .content .decode ()) == {'pk' : pk , 'kwarg' : kwarg , 'param' : param }
582+
564583 def test_defaultrouter_root (self ):
565584 response = self .client .get ('/default/' )
566585 assert response .status_code == 200
0 commit comments