On Thu, Feb 14, 2008 at 12:41 PM, Johan Liseborn
<[EMAIL PROTECTED]> wrote:
>  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.)

Should be able to do this relatively simple within the middleware your
created by following the example @
http://code.djangoproject.com/wiki/CookBookThreadlocalsAndUser to get
the current user outside a request, you just adapt it to get the
current site outside a request. Then your Manager looks something like
http://dpaste.com/35305/

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