Opened 6 years ago
Closed 6 years ago
#30273 closed Bug (worksforme)
ModelAdmin for proxy model with InlineModelAdmin for superclass reference results in admin.E202
Reported by: | jwindhager | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 2.1 |
Severity: | Normal | Keywords: | proxy, InlineModelAdmin, E202 |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Assume the following Django models:
class Reporter(models.Model): ... class Journalist(Reporter): ... class Meta: proxy = True class Article(models.Model): reporter = models.ForeignKey(Reporter) ...
Register model admins as follows (exemplary):
class ArticleInline(admin.TabularInline): model = Article fk_name = 'reporter' ... @admin.register(Journalist) class JournalistAdmin(admin.ModelAdmin): inlines = [ArticleInline] ...
This will result in the following error:
<class 'ArticleInline'>: (admin.E202) fk_name 'reporter' is not a ForeignKey to 'Journalist'.
Attachments (1)
Change History (3)
comment:1 by , 6 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 6 years ago
Attachment: | test30273.zip added |
---|
comment:2 by , 6 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
This works for me. I attached a demo project, please have a look. Maybe I did misunderstood you somehow. I tested with Django 2.1.7 and master.
Note:
See TracTickets
for help on using tickets.
DemoProject which actually works