2👍
You can customize the formset used by inline for your B model, you can override a clean()
method on it:
class InlineModelAdmin(BaseModelAdmin):
...
formset = MyInlineFormSet
...
and
from django.forms.models import BaseInlineFormSet
class MyInlineFormSet(BaseInlineFormSet):
def clean(self):
super(MyInlineFormSet, self).clean()
# Your custom validation. You can access all the forms via `self.forms`
Please refer to the docs and code:
👤twil
Source:stackexchange.com