首页 > 解决方案 > 我可以在 Django 中再次使用 urls 参数吗?

问题描述

path('list/<location_id>/', views.MyView.as_view(), name='myview'),
path('list/<location_id>/<category_id>/', views.MyView.as_view(), name='myview_category')

我使用主页'myapp/list/2/','myapp/list/4/',......
我想在myview中使用类别功能。
但是我无法在 HTML 中再次编写使用 location_id 的 url 链接。

<li><a href="{% url 'cafeyo:myview_category' location_id=# category_id=1 %}">category 1</a></li>

如何使用 location_id ???
请帮我...

标签: htmldjangodjango-urls

解决方案


推荐阅读