如何更改django wagtail的管理员徽标 [英] How to change django wagtail's admin logo

查看:74
本文介绍了如何更改django wagtail的管理员徽标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个小项目,所以我想尝试一下:

要替换默认徽标,请创建一个模板文件 your_app/templates/wagtailadmin/base.html ,该文件将覆盖如下所示的branding_logo块:

  {%过度扩展了"wagtailadmin/base.html"%}{%阻止branding_logo%}< img src =" {{STATIC_URL}} images/custom-logo.svg"alt =自定义项目"宽度="80"/>{%endblock%} 

检查 Wagtail自定义品牌以获取更多详细信息


(编辑2020年12月)

注意:在Wagtail的最新版本中,不再需要 django-overextends .现在,它使用 Django 模板的默认 extends 标记.咨询文档以获取更多信息

I am working on a small project and I thought I'd give wagtail a try. I am now wondering how I could change wagtail's admin logo in the sidebar (top left image on the picture bellow).

I could change /static/wagtailadmin/images/wagtail-logo.svg directly but it'd be wrong ;).

解决方案

Wagtail already provide the solution in the official documentation using django-overextends:

To replace the default logo, create a template file your_app/templates/wagtailadmin/base.html that overrides the block branding_logo as follow:

{% overextends "wagtailadmin/base.html" %}

{% block branding_logo %}
    <img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
{% endblock %}

Check Wagtail Custom branding for more details.


(Edit Dec - 2020)

Note: In the latests versions of Wagtail django-overextends is not needed anymore. It uses now the default extends tag of Django templates. Consult the docs for more information

这篇关于如何更改django wagtail的管理员徽标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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