How to use custom managers in reverse relationships?

I want to get related object references and I want to use a custom manager.

I see there has already been a question about this, but it is no longer open. So I create a new Edit: And deprecated.

This is pretty much what I'm trying to do: Link to related objects with a custom manager

b.entry_set.all() # This will use the default Manager
b.custom_manager.entry_set.all() # This should use my custom model manager

      

I see the ticket is closed, but I haven't found a solution for it yet. https://code.djangoproject.com/ticket/3871

Im using django 1.6.5

+3


source to share


2 answers


I only found this solution:



instance.entry_set(manager='custom_manager')

      

+4


source


In Django 1.8, you can override the attribute _default_manager

that is used for backward relationships (and direct requests via objects

).



0


source







All Articles