Re: Passing variables to css file in django

2013-08-27 Thread Giulio Calacoci
May I suggest to save user defined css to a file saved in a specific path? for example if user John_Doe submits a customized css, save it in //css/users/john_doe/override.css then in the head of the html file load the user defined css always after the default one. this way is always static,

Re: Passing variables to css file in django

2013-08-26 Thread Chris Lawlor
The simplest solution is probably to keep all of the CSS that users can't customize in an external file (to be served as a static asset), but move anything that's user customizable to the of your base template, in a

Re: Passing variables to css file in django

2013-08-25 Thread Robin Lery
Oh! I am sorry. What I meant was, how do I let users customize their page if they wanted to? I suppose I could have done this without using external stylesheet, but yes, CSS is served fastest if it's static. I hope, I made myself clear. Please guide me if there's a way to achive this On Mon, Aug

Re: Passing variables to css file in django

2013-08-25 Thread Andy McKay
Any string can be rendered as a template. This is covered pretty well in the docs: https://docs.djangoproject.com/en/dev/ref/templates/api/ For example: >>> from django.template import Context, Template >>> t = Template("body { background-color: {{ bgcolor }} }") >>> c = Context({'bgcolor': '#99

Passing variables to css file in django

2013-08-25 Thread Robin Lery
Is it possible to pass variables in css files, like in html file. Example: In views.py: def home(request): bgcolor = "#999" ... ... In the css file: body { background-color : {{bgcolor}}; } If yes, can you please guide me how to achieve this? I wou