Do not display already selected items as choices in the dropdown in django admin inline but preserve already selected

I am using Tabularinline class inside the django admin for many to many relation. I want to filter the queryset so already selected can't be chosen.

I tried to override formfield_for_foreignkey method and it partially does the job. Choices are in the desired they (What is already selected are not present in the choices) but the default state is empty for the fields which already exist and when I try to submit a form it throughs an error indicating that the field is required (which should be this way)

I don't know how to achieve this goal without overriding the admin template

enter image description here

This is how the admin panel looks like

enter image description here

Back to Top