﻿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
34927	ModelAdmin for model with InlineModelAdmin for proxy class reference results in admin.E202	Quinten Kock	Antoine Cheneau	"This is similar to #30273 and #32975. A class references a proxy model, and we define an inline for the proxied model. This fails with admin.E202 because Django does not recognize that the FK to the proxy model is the same as an FK to the proxied model.

Assume models as follows:

{{{
class Reporter(models.Model):
    name = models.CharField(max_length=50)

class Journalist(Reporter):
    class Meta:
        proxy = True

class Article(models.Model):
    reporter = models.ForeignKey(Journalist, on_delete=models.CASCADE)
}}}

and an admin as follows:
{{{
class ArticleInline(admin.TabularInline):
    model = Article
    fk_name = 'reporter'

@admin.register(Reporter)
class ReporterAdmin(admin.ModelAdmin):
    inlines = [ArticleInline]
}}}

This will result in {{{<class 'testapp.admin.ArticleInline'>: (admin.E202) fk_name 'reporter' is not a ForeignKey to 'testapp.Reporter'.}}}
 
The problem seems to be that the parent list does not include the model itself, and as such Django does not recognize the equality here."	Bug	closed	contrib.admin	4.2	Normal	fixed	proxy, InlineModelAdmin, E202		Ready for checkin	1	0	0	0	0	0
