为什么NojverseMatch在django管理员change_form

时间:2013-11-08 17:25:52

标签: python django

在我的admin.py中我有:

def get_urls(self):
    urls = super(AggregationProxyProviderAdmin, self).get_urls()
    my_urls = patterns('', 
        url(r'^(\d+)/import_proxies/$',
            self.admin_site.admin_view(self.import_proxies_from_file), 
            name="import_proxies", 
        ), 
    )
    return my_urls + urls

在change_form.html中我有

<a href="{% url opts|admin_urlname:'import_proxies' original.pk|admin_urlquote %}" class="btn importlink">

我得到了错误:

Exception Type:     NoReverseMatch
Exception Value:    

Reverse for 'aggregation_aggregationproxyprovider_import_proxies' with arguments '(1L,)' and keyword arguments '{}' not found.

有人可以解释问题在哪里吗? 感谢

1 个答案:

答案 0 :(得分:0)

解决方案是将url命名为:aggregation_aggregationproxyprovider_import_proxies