#897: Bi-Directional ManyToMany in Admin
---------------------------------+------------------------------------
     Reporter:  anonymous        |                    Owner:  nobody
         Type:  Bug              |                   Status:  new
    Component:  contrib.admin    |                  Version:  5.1
     Severity:  Release blocker  |               Resolution:
     Keywords:                   |             Triage Stage:  Accepted
    Has patch:  0                |      Needs documentation:  0
  Needs tests:  0                |  Patch needs improvement:  0
Easy pickings:  0                |                    UI/UX:  0
---------------------------------+------------------------------------
Changes (by Shai Berger):

 * cc: Shai Berger (added)
 * severity:  Normal => Release blocker
 * type:  New feature => Bug
 * version:   => 5.1

Comment:

 I was very surprised to see this 3-digit ticket, because I saw the
 functionality mostly work on Django 2.2 to 4.2.

 The issue described in comment:48 was in fact introduced in 5.1, while
 fixing #35056: A check rejecting M2M fields with through models on the
 admin was crashing on reverse relations, and the fix for it rejects
 **all** reverse M2M fields from the admin, whether they do or don't have a
 through relation.

 This change in {{{django/contrib/admin/checks.py}}} should fix the check
 itself, but some tests would need to be added too...
 {{{#!diff
 535c535
 <             if not field.many_to_many or isinstance(field,
 models.ManyToManyRel):
 ---
 >             if not field.many_to_many:
 539c539,544
 <             elif not field.remote_field.through._meta.auto_created:
 ---
 >             through = (
 >                 field.through
 >                 if isinstance(field, models.ManyToManyRel)
 >                 else field.remote_field.through
 >             )
 >             if not through._meta.auto_created:
 }}}

 In the current state, this breaks existing Django projects -- it's a
 regression introduced in the last release, so as far as I understand, it
 merits Release Blocker status. I'm just not sure if it's better to make
 the Release Blocker a new bug, leaving just whatever part is left of this
 one ([comment:43 history?]) here.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/897#comment:51>
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 view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070194f6986200-4d48ea28-2af3-45e8-8307-de55239c4d53-000000%40eu-central-1.amazonses.com.

Reply via email to