﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
22034	Checks for ModelAdmin ForeignKeys fail with GenericInlineModelAdmin	Julian Wachholz	josven	"Checks `admin.E202` fail when trying to detect a `ForeignKey` from a `GenericInlineModelAdmin`:

The following setup yields this error:

{{{
<class 'app.admin.BarInline'>: (admin.E202) 'app.Bar' has no ForeignKey to 'app.Foo'.
}}}

`models.py`
{{{
class Foo(models.Model):
    """"""Foo may have some Bars.""""""
    text = models.TextField()

class Bar(models.Model):
    text = models.TextField()

    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = generic.GenericForeignKey('content_type', 'object_id')
}}}

`admin.py`
{{{
class BarInline(GenericStackedInline):
    model = Bar

@admin.register(Foo)
class FooAdmin(admin.ModelAdmin):
    inlines = [BarInline]
}}}

I think this will require an exception in `_check_fk_name` for generic InlineAdmin classes here:
https://github.com/django/django/blob/06bd181f97e5e5561ae7e80efae4c38ee670773f/django/contrib/admin/checks.py#L866
"	Bug	closed	contrib.admin	dev	Release blocker	fixed	checks		Accepted	0	0	0	0	0	0
