tags:

views:

75

answers:

2

I'm using the middleware to detect the subdomain and place a corresponding object in the request scope. Would it be possible to take it further and declare that the subdomain implements these urls but not those?

Something like?

if request.subdomain.is_blue:
     include(these.urls)
A: 

You can poke around with request.urlconf, but that can break things

oggy
+3  A: 

the urlconf is executed at startup time, not for each request; so you don't have the opportunity to include or not according to the URL used to acess.

the best would be to write your own middleware, or a restricting decorator (like @login_required), it's quite easy to write your own decorator (i like them more than middlewares for most specific tasks)

Javier
A decorator like "@blue_required" does sound like a tidy solution. Thanks.
John Mee