Change History (8)

<class 'app.admin.BarInline'>: (admin.E202)'app.Bar' has no ForeignKey to 'app.Foo'.
Bar.content_object: (contenttypes.E001) The field refers to "Bar.object_id" field which is missing.
Bar.content_object: (contenttypes.E005) The field refers to Bar.content_type field which is missing.

As far as the dependency goes, could we have a Inline._check_fk() on all inlines that lazy-imports code to handle the check?

Or, have a hook like Inline._checks = 'django.contrib.contenttypes.checks.GenericInlineModelAdminChecks'

As a side note, I like to do hacky things with my inlines (like store data in json on the original model) and sometimes that means it doesn't make sense to have an actual foreign key. And it would be nice to have a way to override the error.

The problem here is that GenericInlineModelAdmin is using the base InlineModelAdmin checks. We just need to make GenericInlineModelAdmin run it's own, generic-specific checks of the relation to the parent.