Changes between Version 1 and Version 2 of Ticket #34207, comment 3
- Timestamp:
- Dec 10, 2022, 12:19:57 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34207, comment 3
v1 v2 9 9 To make it clear, intermediary models that don't define a strict unique relationship on `(from, to)` are supported. However `add(through_defaults)` is focused on enforcing that at least one entry of the `(from, to)` tuple exists and doesn't make any assumption with regards to the unique constraints defined on the intermediary model. 10 10 11 If you want to enforce the unique existence of a tuple that is a superset of the the `(from, to)` relationship you should use `get_or_create` instead of expecting `add (through_defaults)` to figure out which of your unique constraints should be enforced based on your provided `through_defaults`.11 If you want to enforce the unique existence of a tuple that is a superset of the the `(from, to)` relationship you should use `get_or_create` instead of expecting `add` to figure out which of your unique constraints should be enforced based on your provided `through_defaults` (as there could be many). 12 12 13 13