Problem : We have a django admin forms with Department and Employee models ,where a Department is a Foreign Key to each employee ( Each employee belongs to one department) . In one scenario we want to edit a department , and while editing the department model we want to see only those Employees in the drop down list having relevance to the department / model being edited. So the use case will be
- List of Department to edit.
- Click Department and Department page opens
- Here only the Employees applicable to the department being edited and not the super set. Normally django will show all the objects linked to the Model and not only the ones linked to the one being edited
Now when we edit we will see only the employees relevant to the department we are editing.
....With this we are good to go !