Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何设计 url 模式:
http://127.0.0.1:8000/add/id/number
url(r'^add/$)
number - 数字 1-5 (1,2,3,4,5)
你的意思是:
url( r'^add/(?P<id>\d+)/(?P<number>\d{1,5})/', 'add', name="add" ),
像这样,如果您的视图接受一个number参数(并且数字是一位数):
number
url(r'^add/id/(?P<number>[0-5])$)