Linking to the django admin site

北慕城南 提交于 2019-11-28 05:41:23
Romain

Try what Oggy is suggesting but then use ':' instead of '_' with the current Django:

<a href="{% url 'admin:index' %}">link to admin panel</a>

Which django version are you using? If you're using trunk, change your admin urlpatterns from:

(r'^admin/(.*)', admin.site.root)

to:

('^admin/', include(admin.site.urls))

And then you get a named URL pattern called 'admin_index' which you can refer to. See

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls

for more information

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!