Modifying the model manager

If you want to use “objects” as a field name or if you want to use a name other than objects for the Manager, you can rename it on a per-model basis. To rename the Manager for a given class, define a class attribute of type models.Manager() on that model.

In this example we have created 2 custom managers “all_senior_employees” and “all_managers”.
Employee.all_senior_employees.all() returns only senior employees by modifying the queryset by adding filter by role ‘Senior’. “all_managers” modifies the queryset to return only Employees whose role is ‘Manager’. This is fairly simple example, We can use similar technique on complex queries.