Reputation: 99
I would like to know if there is some way to change a css class from a template page using django admin. I would like to put the django tag inside of css file.
example:
body {
background-color: {{ body.color }};
width: {{ body.width }};
}
Upvotes: 0
Views: 330
Reputation: 366
You could also include your CSS file using template tags. That would demand a style tag but considering the dynamic approach here it's really not much of an issue:
<html>
<head>
<style type="text/css">
{% include 'templates/mytemplate.css' %}
</style>
</head>
<body></body>
</html>
The template could then be what you described above. Then the CSS template would have access to whatever data your base template has access too.
Depending on your use case you might also do something with blocks but I'm not sure that is worth exploring at this point.
Upvotes: 2
Reputation: 3556
Just off the top of my head:
Upvotes: 1