Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

Nadège Michel
Hello,
 
We use self.referencing ManyToMany relationships with intermediate tables in our work project 
and I was wondering why we had to create ourselves the reverse link when we need the relationship to be symmetrical.
I looked at the 'symmetrical' attribute documentation and though we should just set it to True instead of False, 
but you may know that it triggers the error "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical.".

I searched for a corresponding existing ticket a found this one which is kind of related https://code.djangoproject.com/ticket/9475
And you can see in the PR some discussion about the check https://github.com/django/django/pull/8981#discussion_r247946460
Thanks to the work of Collin Anderson in the previous PR I think we can now remove that check.

Questions I had:
  • retro compatibility?
As the current behavior forces the user to set 'symmetrical=False', the change is retro-compatible.
  • use 'through_defaults' when creating both objects or define a new 'through_reverse_defaults' to give different values for each row? 
if you want symmetrical relationship, both objects should have the same values 
so I chose to use 'through_defaults' for both objects. Which was also what was done in the #8981 PR in the first place.

I have a patch with theses changes:
  • removed the check 
  • removed tests for that check
  • added tests (tests/m2m_through, tests/m2m_recursive)
  • updated documentation (may need a bit more work)
  • added back the use of 'through_defaults' of #8981 in the:
if self.symmetrical:  
self  ._add_items(...) 

Tests suite runs fine.

Any thoughts on this design change / new feature?  
I'll be happy to create a ticket and submit my patch for reviews :) 

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/3e2f799d-3444-407b-bc81-523c3f55ec0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

Aymeric Augustin
Hello Nadège,

While I'm not an expert of this area, your proposal makes sense to me. It looks like a reasonable extension of previous work. You can go ahead with a ticket and a pull request.

Best regards,

-- 
Aymeric.



On 23 Apr 2019, at 12:09, Nadège Michel <[hidden email]> wrote:

Hello,
 
We use self.referencing ManyToMany relationships with intermediate tables in our work project 
and I was wondering why we had to create ourselves the reverse link when we need the relationship to be symmetrical.
I looked at the 'symmetrical' attribute documentation and though we should just set it to True instead of False, 
but you may know that it triggers the error "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical.".

I searched for a corresponding existing ticket a found this one which is kind of related https://code.djangoproject.com/ticket/9475
And you can see in the PR some discussion about the check https://github.com/django/django/pull/8981#discussion_r247946460
Thanks to the work of Collin Anderson in the previous PR I think we can now remove that check.

Questions I had:
  • retro compatibility?
As the current behavior forces the user to set 'symmetrical=False', the change is retro-compatible.
  • use 'through_defaults' when creating both objects or define a new 'through_reverse_defaults' to give different values for each row? 
if you want symmetrical relationship, both objects should have the same values 
so I chose to use 'through_defaults' for both objects. Which was also what was done in the #8981 PR in the first place.

I have a patch with theses changes:
  • removed the check 
  • removed tests for that check
  • added tests (tests/m2m_through, tests/m2m_recursive)
  • updated documentation (may need a bit more work)
  • added back the use of 'through_defaults' of #8981 in the:
if self.symmetrical:  
self  ._add_items(...) 

Tests suite runs fine.

Any thoughts on this design change / new feature?  
I'll be happy to create a ticket and submit my patch for reviews :) 

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/3e2f799d-3444-407b-bc81-523c3f55ec0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/8B0DF00A-8241-4454-80C9-D1F6B91DAA14%40polytechnique.org.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

Asif Saif Uddin
In reply to this post by Nadège Michel
After reading your reasoning and code it seems logical for me. Let's create a pr for more input.

On Tuesday, April 23, 2019 at 6:13:35 PM UTC+6, Nadège Michel wrote:
Hello,
 
We use self.referencing ManyToMany relationships with intermediate tables in our work project 
and I was wondering why we had to create ourselves the reverse link when we need the relationship to be symmetrical.
I looked at the 'symmetrical' attribute documentation and though we should just set it to True instead of False, 
but you may know that it triggers the error "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical.".

I searched for a corresponding existing ticket a found this one which is kind of related <a href="https://code.djangoproject.com/ticket/9475" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F9475\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGhw9LzQN6vwJ-O-uZAQb_tspfcVQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F9475\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGhw9LzQN6vwJ-O-uZAQb_tspfcVQ&#39;;return true;">https://code.djangoproject.com/ticket/9475
And you can see in the PR some discussion about the check <a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">https://github.com/django/django/pull/8981#discussion_r247946460
Thanks to the work of Collin Anderson in the previous PR I think we can now remove that check.

Questions I had:
  • retro compatibility?
As the current behavior forces the user to set 'symmetrical=False', the change is retro-compatible.
  • use 'through_defaults' when creating both objects or define a new 'through_reverse_defaults' to give different values for each row? 
if you want symmetrical relationship, both objects should have the same values 
so I chose to use 'through_defaults' for both objects. Which was also what was done in the #<a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">8981 PR in the first place.

I have<a href="https://github.com/django/django/compare/master...nadege:allow-m2m-intermediate-symmetrical" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...nadege%3Aallow-m2m-intermediate-symmetrical\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbsGKy9-S7toq766bTyCNMy3jLZQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...nadege%3Aallow-m2m-intermediate-symmetrical\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbsGKy9-S7toq766bTyCNMy3jLZQ&#39;;return true;"> a patch with theses changes:
  • removed the check 
  • removed tests for that check
  • added tests (tests/m2m_through, tests/m2m_recursive)
  • updated documentation (may need a bit more work)
  • added back the use of 'through_defaults' of #<a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">8981 in the:
if self.symmetrical:  
self  ._add_items(...) 

Tests suite runs fine.

Any thoughts on this design change / new feature?  
I'll be happy to create a ticket and submit my patch for reviews :) 

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/50952d85-8a8d-4f0d-9f7d-54322e512d1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

Nadège Michel
In reply to this post by Aymeric Augustin
Thank you for the feedback :)

For reference:
Pull request https://github.com/django/django/pull/11298

Le vendredi 26 avril 2019 19:13:29 UTC+2, Aymeric Augustin a écrit :
Hello Nadège,

While I'm not an expert of this area, your proposal makes sense to me. It looks like a reasonable extension of previous work. You can go ahead with a ticket and a pull request.

Best regards,

-- 
Aymeric.



On 23 Apr 2019, at 12:09, Nadège Michel <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="URfrR9igCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">michel...@...> wrote:

Hello,
 
We use self.referencing ManyToMany relationships with intermediate tables in our work project 
and I was wondering why we had to create ourselves the reverse link when we need the relationship to be symmetrical.
I looked at the 'symmetrical' attribute documentation and though we should just set it to True instead of False, 
but you may know that it triggers the error "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical.".

I searched for a corresponding existing ticket a found this one which is kind of related <a href="https://code.djangoproject.com/ticket/9475" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F9475\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGhw9LzQN6vwJ-O-uZAQb_tspfcVQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F9475\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGhw9LzQN6vwJ-O-uZAQb_tspfcVQ&#39;;return true;">https://code.djangoproject.com/ticket/9475
And you can see in the PR some discussion about the check <a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">https://github.com/django/django/pull/8981#discussion_r247946460
Thanks to the work of Collin Anderson in the previous PR I think we can now remove that check.

Questions I had:
  • retro compatibility?
As the current behavior forces the user to set 'symmetrical=False', the change is retro-compatible.
  • use 'through_defaults' when creating both objects or define a new 'through_reverse_defaults' to give different values for each row? 
if you want symmetrical relationship, both objects should have the same values 
so I chose to use 'through_defaults' for both objects. Which was also what was done in the #<a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">8981 PR in the first place.

I have<a href="https://github.com/django/django/compare/master...nadege:allow-m2m-intermediate-symmetrical" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...nadege%3Aallow-m2m-intermediate-symmetrical\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbsGKy9-S7toq766bTyCNMy3jLZQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...nadege%3Aallow-m2m-intermediate-symmetrical\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbsGKy9-S7toq766bTyCNMy3jLZQ&#39;;return true;"> a patch with theses changes:
  • removed the check 
  • removed tests for that check
  • added tests (tests/m2m_through, tests/m2m_recursive)
  • updated documentation (may need a bit more work)
  • added back the use of 'through_defaults' of #<a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">8981 in the:
if self.symmetrical:  
self  ._add_items(...) 

Tests suite runs fine.

Any thoughts on this design change / new feature?  
I'll be happy to create a ticket and submit my patch for reviews :) 

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="URfrR9igCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-d...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="URfrR9igCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">django-d...@googlegroups.com.
Visit this group at <a href="https://groups.google.com/group/django-developers" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/django-developers&#39;;return true;">https://groups.google.com/group/django-developers.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/django-developers/3e2f799d-3444-407b-bc81-523c3f55ec0b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/django-developers/3e2f799d-3444-407b-bc81-523c3f55ec0b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/django-developers/3e2f799d-3444-407b-bc81-523c3f55ec0b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/django-developers/3e2f799d-3444-407b-bc81-523c3f55ec0b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/f249ec99-073c-4cc4-a4fd-420f578854fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Proposal: Allow ManyToMany using a intermediary table to be defined as symmetrical

Collin Anderson-2
In reply to this post by Nadège Michel
Hi Nadège,

Sorry for the delay. Yeah, when I was working on PR 8981, I ran into the symmetrical case and wasn't sure what the behavior should be, so I left the check in place to not allow the behavior. I asked my self the same question you did about possibly needing "through_reverse_defaults" and didn't have answer. I also didn't have a use-case for symmetrical with intermediary/through. I wasn't sure about other unintended consequences and just wanted to get the rest of the change out the door.

If you think "both objects should have the same value" then I'd say go for it. I suppose it does make sense considering it's supposed to be symmetrical as you said. If later people want through_reverse_defaults we could always add it later.

Thanks,
Collin


On Tuesday, April 23, 2019 at 8:13:35 AM UTC-4, Nadège Michel wrote:
Hello,
 
We use self.referencing ManyToMany relationships with intermediate tables in our work project 
and I was wondering why we had to create ourselves the reverse link when we need the relationship to be symmetrical.
I looked at the 'symmetrical' attribute documentation and though we should just set it to True instead of False, 
but you may know that it triggers the error "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical.".

I searched for a corresponding existing ticket a found this one which is kind of related <a href="https://code.djangoproject.com/ticket/9475" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F9475\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGhw9LzQN6vwJ-O-uZAQb_tspfcVQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fcode.djangoproject.com%2Fticket%2F9475\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGhw9LzQN6vwJ-O-uZAQb_tspfcVQ&#39;;return true;">https://code.djangoproject.com/ticket/9475
And you can see in the PR some discussion about the check <a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">https://github.com/django/django/pull/8981#discussion_r247946460
Thanks to the work of Collin Anderson in the previous PR I think we can now remove that check.

Questions I had:
  • retro compatibility?
As the current behavior forces the user to set 'symmetrical=False', the change is retro-compatible.
  • use 'through_defaults' when creating both objects or define a new 'through_reverse_defaults' to give different values for each row? 
if you want symmetrical relationship, both objects should have the same values 
so I chose to use 'through_defaults' for both objects. Which was also what was done in the #<a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204)" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">8981 PR in the first place.

I have<a href="https://github.com/django/django/compare/master...nadege:allow-m2m-intermediate-symmetrical" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...nadege%3Aallow-m2m-intermediate-symmetrical\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbsGKy9-S7toq766bTyCNMy3jLZQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fcompare%2Fmaster...nadege%3Aallow-m2m-intermediate-symmetrical\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHbsGKy9-S7toq766bTyCNMy3jLZQ&#39;;return true;"> a patch with theses changes:
  • removed the check 
  • removed tests for that check
  • added tests (tests/m2m_through, tests/m2m_recursive)
  • updated documentation (may need a bit more work)
  • added back the use of 'through_defaults' of #<a href="https://github.com/django/django/pull/8981#discussion_r247946460" style="color:rgb(17,85,204);font-size:small" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fdjango%2Fdjango%2Fpull%2F8981%23discussion_r247946460\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFHFWXlXCMsyP2WLzGs-ZGt7OR0mg&#39;;return true;">8981 in the:
if self.symmetrical:  
self  ._add_items(...) 

Tests suite runs fine.

Any thoughts on this design change / new feature?  
I'll be happy to create a ticket and submit my patch for reviews :) 

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/4ef6730a-1f81-456c-9e05-7373da73da5e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.