I'm using django-cms admin style. I managed to change the default DjangoCMS logo, by following the solution mentioned here: Django cms 3.4.1 admin dlogo
Now the logo is a static one, but I want it to be dynamic, meaning it should get the image path from the database, where the location is stored.
As these admin pages are not render through views.py, I'm not able to sent the querysets to it.
Can anyone suggest how to do it?
using context_processors
we can do this.
first need to get this: https://github.com/divio/djangocms-admin-style/blob/master/djangocms_admin_style/templates/admin/inc/branding.html
branding.html file must be put inside templates folder under admin/inc folder, so the structure will be like this templates/admin/inc/branding.html
now suppose through context_processor we got company_logo
, that holds the logo url from database.
then in branding.html <div id="header-logo">
would be like:
<div id="header-logo">
{% if company_logo %}
<a href="/"><img src="{{ company_logo.url }}" style="height:inherit;"></a>
{% else %}
<a class="icon-logo" href="/"><span>django CMS</span></a>
{% endif %}
</div>