How to change django wagtail's admin logo

社会主义新天地 提交于 2019-12-09 12:34:54

问题


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 ;).


回答1:


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.




回答2:


The logo is defined here:

https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailadmin/templates/wagtailadmin/base.html#L7

To override it, you'll need an app which contains templates/wagtailadmin/base.html and precedes wagtail in INSTALLED_APPS.

Good luck!



来源:https://stackoverflow.com/questions/24536034/how-to-change-django-wagtails-admin-logo

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