#34207: Incorrect SQL query when adding a ManyToMany related object with a "through" table prevents adding a new relationship if the new relationship is identical except for a different value for "through_defaults" -------------------------------------+------------------------------------- Reporter: Credentive | Owner: nobody Type: Bug | Status: closed Component: Database layer | Version: 4.1 (models, ORM) | Severity: Normal | Resolution: duplicate Keywords: ManyToManyField | Triage Stage: through | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by Simon Charette):
* status: new => closed * resolution: => duplicate Comment: `through_defaults` are values that are used to create a missing relationship between two entities that related to each other through a many-to-many relationship. If the relationship already exists between the origin and the destination, like it's the case when you do `statement.section.add(sect, through_defaults={"sl_version":new_version})`, then they are ignored as expected as `ManyToManyField` only supports a single related value between two entities. This is reflected in other APIs such as `statement.section.remove` which doesn't specify through values. In other words, while `ManyToManyField` supports relationship annotations these annotations cannot uniquely define the relationship between the related objects; `ManyToManyField` doesn't support multi-dimensional relationships. Duplicate of #33209 -- Ticket URL: <https://code.djangoproject.com/ticket/34207#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 view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070184fc7121a2-04401540-2508-4ac7-a802-dd8ded6bb266-000000%40eu-central-1.amazonses.com.