I have an Admin site which I want to filter based on request.user.

My ModelAdmin class is something like this,

class FilterOnUser(admin.ModelAdmin):
    def queryset(self, request):
        return self.model._default_manager.filter(user = request.user)

    def get_form(self, request, obj=None, **kwargs):
        form_class = super(FilterOnUser, self).get_form(self, request,
**kwargs)
        class MyModelForm(form_class):
            def get_queryset(self):
                import pdb
                pdb.set_trace()
                return super(MyModelForm,
self).get_queryset().filter(board = request.board)
     return MyModelForm

So when I navigate to the change view on my admin site the
pdb.set_trace is not hit. What am I doing wrong?



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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