On my django site, I want to offer several themes for our best customers and for the boss. So I quickly created the following. βI'm glad I agreed to introduce it, but there are a few dirty hacks that I want to eliminate with the help of the nice decisions I ask for.β
Here is my hack
base.html says (be careful - ugly!)
{% ifequal theme "0" %}
{% include "base_d0.html" %}
{% endifequal %}
{% ifequal theme "1" %}
{% include "base_d1.html" %}
{% endifequal %}
{% ifequal theme "2" %}
{% include "base_d2.html" %}
{% endifequal %}
Then I saved in MEDIA dir subdirs for all common css and js
and created tear
static/
d0/ ( all theme 0 stuff )
css/
js/
d1/ ( all theme 1 stuff )
css/
js/
...
css/
(all common css)
js/
(all common js)
My controller has a design switching method, the current one is stored in a cookie. It is checked with every request and in the template the PREFIX_STATICcontext variable corresponding to /mypathto/static/d0 resp. +d1 +d2, and, of course, I had to invent COMMON_STATICvar. And the var theme is also set for the base.html switch.
, googled , ( , )