Changes between Initial Version and Version 1 of Ticket #34207, comment 3
- Timestamp:
- Dec 10, 2022, 12:19:25 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34207, comment 3
initial v1 3 3 Could you elaborate on that? From what I can read none of the examples you linked suggest that `add` supports this feature? 4 4 5 There is effectively a section that points at the fact that `remove(related)` will remove all entries matching the `(from, to)` tuple but defined by the many-to-many 5 There is effectively a section that points at the fact that `remove(related)` will remove all entries matching the `(from, to)` tuple but defined by the many-to-many but I don't see how that demonstrates that your reported use case should be supported. 6 6 7 7 In the example you've just provided you don't use `members.add` to add the second relationship to Ringo but rely on explicit `Membership` creation which is supported. … … 10 10 11 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`. 12 13 14 {{{#!python 15 StatementLocation.objects.get_or_create( 16 section=sect, 17 statement=statement, 18 sl_version=new_version, 19 ) 20 }}}