没有与其中包含 / 的数据进行反向匹配

No reverse match with data that has / in it

我有一个包含学生 ID 的系统。当我保存一个带有 / 的 id 时,系统 returns 没有反向匹配错误,但可以使用没有斜杠的 id。可能是什么问题呢? 我的 url

path('borrowed/<borrowed>',views.all_borrowed,name='all_borrowed'),

错误

Reverse for 'all_borrowed' with arguments '('557/2019',)' not found. 1 pattern(s) tried: ['library/borrowed/(?P<borrowed>[^/]+)$']

一个<str:…> path converter [Django-doc] does not accept a slash in the parameter, you can work with the <path:…> path converter [Django-doc]:

path('borrowed/<<b>path:</b>borrowed>/',views.all_borrowed,name='all_borrowed'),