#26998: E013 check is over-zealous -------------------------------+-------------------------------------- Reporter: aaugustin | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 1.10 Severity: Normal | Resolution: Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+-------------------------------------- Description changed by aaugustin:
Old description: > After upgrading a project to Django 1.10, it failed to start because of a > system check: > > {{{ > <class 'blog.admin.PostAdmin'>: (admin.E013) The value of > 'fieldsets[2][1]["fields"]' cannot include the many-to-many field 'tags' > because that field manually specifies a relationship model. > }}} > > The corresponding M2M field is managed by django-taggit. > > It's declared as follows: > > {{{ > tags = TaggableManager( > verbose_name="libellés", blank=True, > through=TaggedPost, related_name='tag+') > }}} > > and the manager is just: > > {{{ > class TaggedPost(TaggedItemBase): > content_object = models.ForeignKey("blog.Post") > }}} > > I suppose the intent of this check is to prevent developers from using > the admin's M2M widget when the through model has extra fields. > > However, in my case, the through model doesn't have extra fields, so the > check isn't testing the right thing. > > This issue didn't happen with Django 1.9 because the test for this check > was written slightly differently and django-taggit slipped through the > cracks. > > It's likely possible to work around this issue with a hack in django- > taggit, but it seems to me that this check doesn't use the right logic > and could be improved, so I'm filing this ticket. New description: After upgrading a project to Django 1.10, it failed to start because of a system check: {{{ <class 'blog.admin.PostAdmin'>: (admin.E013) The value of 'fieldsets[2][1]["fields"]' cannot include the many-to-many field 'tags' because that field manually specifies a relationship model. }}} The corresponding M2M field is managed by django-taggit. It's declared as follows: {{{ tags = TaggableManager( verbose_name="libellés", blank=True, through=TaggedPost, related_name='tag+') }}} and the manager is just: {{{ class TaggedPost(TaggedItemBase): content_object = models.ForeignKey("blog.Post") }}} I suppose the intent of this check is to prevent developers from using the admin's M2M widget when the through model has extra fields. However, in my case, the through model doesn't have extra fields, so the check isn't testing the right thing. This issue didn't happen with Django 1.9 because the test for this check was written slightly differently and django-taggit slipped through the cracks. It's likely possible to work around this issue with a hack in django- taggit, but it seems to me that this check doesn't use the right logic and could be improved, so I'm filing this ticket. The corresponding issue django-taggit is https://github.com/alex/django- taggit/issues/430. -- -- Ticket URL: <https://code.djangoproject.com/ticket/26998#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.b3649a7f41793119e00c2d4898f11193%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.