have you gone through the below url: http://www.b-list.org/weblog/2007/nov/01/django-tips-template-loading-and-rendering/
On Jun 22, 5:49 pm, z0n3z00t <maxna...@gmail.com> wrote: > 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/cb... > > 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 django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---