Opened 8 years ago

Last modified 8 years ago

#26998 closed Bug

E013 check is over-zealous — at Version 1

Reported by: Aymeric Augustin Owned by: nobody
Component: contrib.admin Version: 1.10
Severity: Release blocker Keywords:
Cc: nate-djangoproject@…, cmawebsite@…, jonathan.morgan.007@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Aymeric Augustin)

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.

Change History (1)

comment:1 by Aymeric Augustin, 8 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top