I have a common site that is used by different clients.  Each client
wants to be able to custom-brand the site to their liking.

How it works: I provide a default theme for the site, i.e. templates
and media, that clients can easily export and customise to their
liking.  All default template files are stored in a templates/default
directory on the server, and all default media inside a media/default
directory.

When they've done their customisations, clients use a form to upload
an archive that contains all the template and media files that they
want to override.  These uploaded theme archives are extracted using
this convention:  Each customer's overridden templates and media would
be extracted to templates/custXXX and media/custXXX.

I quite like the way that the django template loaders are chained
together in a sequence to find a specific template file - this is
exactly the way I want my templates to load:  try to find the client's
custom template inside the client's template folder and, failing that,
load the default template.

To do this the template loader needs access to the request object to
determine request.user and work out which company he belongs to.
(Only the login page is common across all clients, since the client
can't be established)

The problem is that the request object is not passed to the template
loaders.  John Boxall posted a possible work-around using middleware
and threading to store the request object here:
http://groups.google.co.za/group/django-users/browse_thread/thread/cb92339600e6f75e/d221d2eded2de47d?hl=en&lnk=gst&q=request+aware+template+loader

What I like about this is that it doesn't touch the framework.  What I
don't like is the fact that it's such an ugly hack.

Does anyone know of a more elegant solution?  I'd appreciate any ideas
on how to achieve this without hacking the framework.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to