hmm, yeah, that's about what I am looking for (the site lang
approach). I'll look into that some more.

For this particular app, there are no stored user profiles (e.g. there
is no logging in), so as much as I'd like to store this setting in a
user profile, and requiring login, I can't guarantee that here.

The primary view that will take advantage of this is a registration/
survey page that I want to have different themes on depending on the
partner/ group that is directing users to the site. When someone
registers, I need to track the theme as well, but it's more for the
look and feel when the users visit the site.

I can probably get away with restricting it to this particular app (in
the middleware) and just create a list of common view urls that it
should ignore when looking at the theme portion of the url, so as to
avoid strange path catches.

-Chris

On May 31, 2:33 am, orestis <[EMAIL PROTECTED]> wrote:
> I've done something similar to this, putting the site language in the
> url.
>
> Basically you create a middleware process_request, that will take
> request.path and set it to something else.
>
> For example you might do:
>
> request.path = "/app/theme/view/"
>
> parts = request.path.split("/")
>
> request.path = "/"+parts[0]+"/"+parts[2]
>
> theme = parts[1]
>
> #do something with the theme...
>
> return None
>
> Then your urlconfs will go on without knowing about the theme logic.
>
> Beware, though: This can lead to many strange errors when this catches
> paths you don't want to be processed. You also have to worry about
> search engines. It might be better to apply the same middleware to
> extract something from the session/query parameters.
>
> On May 31, 1:23 am, Robert Coup <[EMAIL PROTECTED]>
> wrote:
>
> > Chris Kelly wrote:
> > > I am in the process of writing an app that will have a "theme" based
> > > on if a subdirectory is specified e.g.:
>
> > >http://somesite.com/app/(theme)/abunchofviews/
>
> > > basically, if they go to /app/bluetheme/register, it'll give them a
> > > registration page with a blue theme header and footer  (it looks up a
> > > theme object based on the value specifed in the url, and gets header
> > > images, etc from said object). Likewise, if "greentheme" is specified,
> > > they would get a green-themed registration page. This way, someone can
> > > later just go into the django admin section and create a new "theme"
> > > by specifying a new header and footer image.
>
> > I know it doesn't answer your question, but search engines will see a
> > different page for each different theme (eg. /red/mypage1 will be seen
> > as a different page from /green/mypage1).
>
> > Maybe storing the theme in a user preference/session might be easier? A
> > user could visit /theme/green/ to set the 'green' theme, then redirect
> > to any of your normal application pages, which use the preference to
> > decide .
>
> > Rob :)


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to