url参数转换器

引入django.urls下的包converters

from djago.urls import converters

1.str: 除了“/”以外的所有字符均可。(没设置转换器默认是该转换器)

2.int: 所有的数字均可满足

3.uuid: 满足uuid编码的字符串,使用uuid.uuid()产生的的字符串

4.path:和str差不多,包含/在内的字符串。

5.slug: 英文状态下的_-(下划线、横线)、英文字母、阿拉伯数字。

例如:

'city/detals/<str:city_id>/<int:category_id>'
原文地址:https://www.cnblogs.com/ambitious-to-49/p/11959429.html