django:如何添加主页链接到管理员 [英] django: how to add home link to admin

查看:93
本文介绍了django:如何添加主页链接到管理员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在模板中的每个页面添加 / 的链接。我可以不改变django内部模板吗?我可以自定义django,但这是我认真不想做的事情。

I would like to add a link to / to every page in template. Can I do it without changing django internal template? I could customize django, but this is something I seriously wouldn't like to do.

推荐答案

当然,只要覆盖其中一个您自己的 templates / admin 目录中的Django管理模板。例如,将 django / contrib / admin / templates / base.html 的内容复制到 yourproject / templates / admin / base.html 。然后,将后者更改为您心中的内容。

Sure, just override one of the Django admin templates in your own templates/admin directory. For instance, copy the contents of django/contrib/admin/templates/base.html into yourproject/templates/admin/base.html. Then, change the latter to your heart's content.

请参阅: https://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-admin-templates

这篇关于django:如何添加主页链接到管理员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆