我在Django 2.0中创建了一个作业请求系统,我需要将两个捕获的值传递给模板。如果我在一个现有品牌slug和类别slug的URL中进行硬编码,这一切都有效
urls.py:
path('request/<slug:brand_slug>/<slug:category_slug>/', views.job_request_step_two, name="job_request_step_two")
我尝试了,但未能尝试在模板中动态设置该网址:
{% url 'form_step_two' brand.slug category.slug %}
运行此,我收到此错误:
NoReverseMatch at /jobs/request/
Reverse for 'job_request_step_two' with arguments '('', '')' not found. 1 pattern(s) tried: ['jobs\\/request\\/(?P<brand_slug>[-a-zA-Z0-9_]+)\\/(?P<category_slug>[-a-zA-Z0-9_]+)\\/$']