Django模板标签`url`没有按预期工作

时间:2018-04-17 07:44:48

标签: django django-templates

目前,我有以下代码:

patterns.append(url(r'^sales/crudeoilsale/$', LVCla.as_view(), name='crudeoilsale-list'))

使用引用它的链接:

<a class="nav-model-container" href="{% url 'crudeoilsale-list' %}"></a>

然后运行此代码会给我错误

NoReverseMatch at /office/
Reverse for 'crudeoilsale-list' not found. 'crudeoilsale-list' is not a valid view function or pattern name.

检查我的网址列表,但它会返回:

^admin/
office/ ^$ [name='office-index']
office/ ^sales/crudeoilsale/$ [name='crudeoilsale-list']
office/ ^sales/tubosale/$ [name='tubosale-list']

有人能告诉我我做错了吗?

0 个答案:

没有答案