Malcolm,

Thanks for your reply!

On Thu, Feb 14, 2008 at 2:55 AM, Malcolm Tredinnick
<[EMAIL PROTECTED]> wrote:
>
>  On Wed, 2008-02-13 at 14:52 +0100, Johan Liseborn wrote:
>
>  >  while my requirement seems to indicate
>  > that the "site" (or pseudo-domain) should be decided by the logged in
>  > user rather than the domain name, so I am a bit pessimistic that I can
>  > accomplish what I say above, even though the two use cases seems very
>  > similar data-handling-wise; please tell me I am wrong... :-)
>
>  Well, they're similar in that different access paths see different data,
>  but that's pretty much everything in web land. The Sites framework is
>  one level at which these access paths can be controlled. You want to
>  control it at a different level: per-request.
>
>  If I was going to be doing this, I'd almost certainly just write up a
>  quick middleware that ran after the authentication middleware on the
>  request path and set an attribute on the request object indicating the
>  "site" (in your model) to use for further lookups. Then it's just a
>  matter of filtering lookups with that restriction each time. Needs a
>  little thought, depending on what you're doing, but certainly possible.

I tried your suggested approach, wrote a small middleware class,  and
I actually got it working quite quickly, thanks!

The thing I am thinking about now is if there is a way to make the
filtering part more "automagic" (like I think the sites-stuff does
it); I was looking at custom managers, but it seems I cannot really do
it like that, because the filter criteria needs to be known when you
define the custom manager, whereas my filter criteria is only known at
run-time, when a specific request hits the server. (What I am worried
about is that I will forget to do the filtering for a view and
accidentally return too much data.)

Anyway, I'll keep at it and see what I can come up with; any
additional input is always appreciated!

Thanks!

Regards,

johan

--~--~---------~--~----~------------~-------~--~----~
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