Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-10-26 Thread David Foster
*Requesting reviewers* for the latest iteration of the PR to bulk-associate many-to-many relationships. *The new PR to review*, which is *only a documentation change* showing how to bulk-associate many-to-many relationships, is here: https://github.com/django/django/pull/11948 👈 In case it's u

Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-10-13 Thread David Foster
Here's the link to the PR for review: https://github.com/django/django/pull/11899 (Apologies for the double-post) - David On Sunday, October 13, 2019 at 3:37:07 PM UTC-7, David Foster wrote: > > I've created a PR which is waiting for review, if someone has time. > > According to Trac, the next

Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-10-13 Thread David Foster
I've created a PR which is waiting for review, if someone has time. According to Trac, the next step is: For anyone except the patch author to review the patch using the patch review checklist

Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-10-01 Thread David Foster
Trac ticket created: https://code.djangoproject.com/ticket/30828 On Tuesday, October 1, 2019 at 3:02:38 AM UTC-7, Tom Forbes wrote: > > Hey David, > I like this idea, while I don’t think the use case is common there have > been a few times where I’ve needed this and got around it by > creating/m

Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-10-01 Thread Tom Forbes
Hey David, I like this idea, while I don’t think the use case is common there have been a few times where I’ve needed this and got around it by creating/modifying the through model in bulk. Having a method that does this would be good IMO. Unless anyone has strong opinions against this then can

Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-09-29 Thread David Foster
Here is another API variation I might suggest: M1.m2_set.add_pairs(*[(m1, m2), ...], assert_no_collisions=False) # --- OR --- M1.m2_set.add_pair_ids(*[(m1_id, m2_id), ...], assert_no_collisions=False) This has the advantages of being more similar to the existing add() API and not requiring a spe

Re: Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-09-26 Thread David Foster
Errata: The proposed default value for assert_no_collisions is False rather than True, for safety. On Thursday, September 26, 2019 at 10:45:45 AM UTC-7, David Foster wrote: > > Given the following example model: > > class M1(models.Model): > m2_set = models.ManyToManyField('M2') > > It is alr

Feature idea: bulk_associate: Add ManyToMany relationships in bulk

2019-09-26 Thread David Foster
Given the following example model: class M1(models.Model): m2_set = models.ManyToManyField('M2') It is already possible to associate *one* M1 with *many* M2s with a single DB query: m1.m2_set.add(*m2s) However it's more difficult to associate *many* M1s with *many* M2s, particularly if yo