About Archive Tag Cloud Translations RSS

You are writing a comment about Customize site style by user with django-userskins, here is a quick summary:

This post briefly introduces the design decisions and usage of django-userskins, which is a pluggable Django application for facilitating users selecting skins for your site. For example, to let user A have a dark theme for your site, and user B have a light scheme. Supports cookie-only persistence as well as cookie-when-possible-database-as-last-resort persistence for skin preferences.


You are responding to this comment written by Shahar Livne on February 18th 2009, 17:24.

Thanks for userskins. It is exactly what I was looking for, and I would have had to implement it myself if it wasn't already available.

Just one remark:

In order to user userskins, TEMPLATE_CONTEXT_PROCESSORS must be active, as it uses this way to inject the skin name to the context. An important condition for its activation is using RequestContext in the view, or in other words, when you use render_to_response, don't forget to add the additional argument: context_instance=RequestContext(request)

If you don't do it, you'll get:

TemplateSyntaxError

Caught an exception while rendering: Failed lookup for key [userskins_skin] in ....

Original Traceback (most recent call last): File "/usr/lib/python2.5/site-packages/django/template/debug.py", line 71, in render_node result = node.render(context) [..] skin = template.Variable("userskins_skin").resolve(context) File "/usr/lib/python2.5/site-packages/django/template/init.py", line 676, in resolve value = self._resolve_lookup(context) File "/usr/lib/python2.5/site-packages/django/template/init.py", line 729, in resolvelookup raise VariableDoesNotExist("Failed lookup for key [%s] in %r", (bit, current)) # missing attribute VariableDoesNotExist: Failed lookup for key [userskins_skin] in ..

So now it will be possible to just google for this error message, and not dig in the source code ;-)

Shahar.


Please be aware that comment forms go stale after one hour.





Comments may make use of LifeFlow MarkDown. Raw html will be escaped.


Quick Introduction to LifeFlow MarkDown Syntax

A highlighted code block:

@@ ruby
def a (b, c):
  b * c
end
@@

Other common languages work as well: scheme, python, java, html, etc.

Other markdown syntax:

 ### This is an h3 title
#### This is an h4 title
**this is bold**
*this is italics*

1. This is an
2. ordered list

* And an unordered
* list too

[this is a link](http://www.lethain.com/ "Lethain")