Opened 11 years ago
Closed 11 years ago
#22212 closed Uncategorized (duplicate)
System check does incorrectly report an error for GenericTabularInline
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Core (System checks) | Version: | 1.7-alpha-2 |
Severity: | Release blocker | Keywords: | contenttype admin systemcheck generic |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When I create a inline for a generic relation:
models.py
class ObjectImage(models.Model): content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') class BlockImages(models.Model): images = generic.GenericRelation(ObjectImage)
admin.py
from django.contrib import admin from django.contrib.contenttypes.admin import GenericTabularInline class ObjectImageInline(GenericTabularInline): model = ObjectImage class BlockImagesAdmin(admin.MoedelAdmin): inlines = [ObjectImageInline] admin.site.register(BlocksImage, BlockImagesAdmin)
I get the following error message when running ./manage.py migrate:
CommandError: System check identified some issues: ERRORS: <class 'foo.admin.BlockImageInline'>: (admin.E202) 'foo.ObjectImage' has no ForeignKey to 'foo.BlockImages'.
Apparently, the new System Checks in Django 1.7 (1.6 does not show this problem) do not take into account Generic Relations.
Note:
See TracTickets
for help on using tickets.
Hi,
This looks like the same error as the one reported in #22034.
Thanks.