【发布时间】:2017-02-08 07:48:07
【问题描述】:
在我的admin.py 文件中,我有:
def get_urls(self):
urls = super(TextAdmin, self).get_urls()
my_urls = patterns('',
url(
r'customfunc1',
customfunc2,
name='customfunc23',
),
)
return my_urls + urls
这将启用以下 URL:
http://localhost:8000/admin/text/customfunc1
它将执行函数customfunc2。我现在的问题是如何通过 reverse 引用这个 URL?
我试过了:
reverse("admin:text_customfunc1")
reverse("admin:text_customfunc2")
reverse("admin:text_customfunc3")
reverse("text:customfunc1")
但这些都不起作用。
【问题讨论】:
标签: python django python-2.7 django-admin