I'm trying to modify the css of a page based on the PageSetting model that I'm using. I'm allowing the user the ability to change how the theme of a page looks like based on some of the PageSetting attributes.
class PageSettings(SingletonModel):
theme = models.IntegerField(choices=THEMES,
verbose_name=_("Theme"),
default=0)
base_color = RGBColorField(blank=False,
verbose_name=_("Base color"),
default="bc0000")
...
What I would like to do is change some values in my css depending on base_color. Pretty much something like this:
# inside my_theme.css
.side-bar {
background: {{ pagesetting.base_color }};
float:left;
width: {{ pagesetting.sidebar_width}}%
...
}
is this acheivble in Django? I know I can do
<div class="sidebar" style='background-color:#{{pagesetting.base_color}};'>
but this makes my html ugly and harder to debug.
<style>tag, but I'm not sure if that's best practiceS(A|C)SS?