I am pretty new with Django, I am customizing my admin section and I'd like to change the CSS according to the app I am browsing. Is it possible? I noticed that the uploaded CSS is the one in the first static folder found by the system. Is there some trick to do this?
I tried to make a static folder in every app but the selected CSS is always the first.
I am trying in this way... but the app_name is always empty even if I am in the admin site... Always the default CSS is loaded (the blue one).
portale_ict/templates/admin/base_site.html
{% extends "admin/base.html" %}
{% block title %}{% if subtitle %}
{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}
{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">Portale ICT Administration</a></h1>
{% endblock %}
{% load i18n static %}
{% block extrastyle %}
<h1>{{ app_name }}</h1>
{% if app_name == 'ict' %}
<link rel="stylesheet" type="text/css" href="{% static 'admin_color_green.css' %}"/>
{% elif app_name == 'ins' %}
<link rel="stylesheet" type="text/css" href="{% static 'admin_color_purple.css' %}"/>
{% endif %}
{% endblock %}
{% block nav-global %}
{% endblock %}
This is working and it'is loading the green CSS (always) but this is not what I want:
{% extends "admin/base.html" %}
{% block title %}{% if subtitle %}
{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}
{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">Portale ICT Administration</a></h1>
{% endblock %}
{% load i18n static %}
{% block extrastyle %}
<link rel="stylesheet" type="text/css" href="{% static 'admin_color_green.css' %}"/>
{% endblock %}
{% block nav-global %}
{% endblock %}
Thank you all.