Search code examples
djangodjango-querysetdjango-managers

How to use custom managers in reverse relations?


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

I see there has been already a question about it, but its not open anymore. So im creating a new one Edit: And its outdated.

This is pretty much what im trying to do: Related objects reference with 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 havent found a solution to it yet. https://code.djangoproject.com/ticket/3871

Im using django 1.6.5


Solution

  • I have found only this solution:

    instance.entry_set(manager='custom_manager')