Just so you have an idea what I am trying to do. :) I have a custom middleware that adds a userBranchID variable to each request according to the users branch in the User model.
Now in each view when I use any queryset I have to do the following: def filter_branch(request, queryset): if settings.DO_BRANCH_FILTER: queryset = queryset.filter(branch__pk = request.userBranchID) return queryset def aview(request): queryset = Model.objects.all() queryset = filter_branch(request, queryset) I would like to avoid running the filter_branch function each time I run a queryset. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.