Re: [Django] #6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__ method

49 views
Skip to first unread message

Django

unread,
Jul 17, 2011, 10:26:58 PM7/17/11
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo | Owner: nobody
<favo@…> | Status: new
Type: | Component: Database layer
Cleanup/optimization | (models, ORM)
Milestone: | Severity: Normal
Version: SVN | Keywords:
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by kmike):

* cc: kmike84@… (added)
* ui_ux: => 0
* easy: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 12, 2011, 4:32:21 PM8/12/11
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo | Owner: nobody
<favo@…> | Status: new
Type: | Component: Database layer
Cleanup/optimization | (models, ORM)
Milestone: | Severity: Normal
Version: SVN | Keywords:
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Changes (by sfllaw):

* cc: sfllaw@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:10>

Django

unread,
Aug 12, 2011, 4:45:24 PM8/12/11
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo | Owner: nobody
<favo@…> | Status: new
Type: | Component: Database layer
Cleanup/optimization | (models, ORM)
Milestone: | Severity: Normal
Version: SVN | Keywords:
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 0
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 0 |
-------------------------------------+-------------------------------------

Comment (by sfllaw):

Because {{{__set__()}}} clears and adds, it does a lot of extra work when
assignment happens, since each object in the new set has to be INSERTed in
the database, even if it's just to add an extra item.

The extra query can be eliminated in {{{_add_items()}}}, which can be told
that its list of {{{*objs}}} do not already exist so it doesn't have to
check for them.

We've hit this problem with m2m_changed on any {{{ModelForm}}}, so it's
not just limited to the admin site.

If there's interest, I can write up a patch that implements this.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:11>

Django

unread,
Jan 19, 2012, 4:04:19 PM1/19/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: SVN
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by jblaine):

* cc: jblaine@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:12>

Django

unread,
Jan 19, 2012, 4:35:31 PM1/19/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: SVN
Component: Database layer | Resolution:
(models, ORM) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 1
Has patch: 1 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by jblaine):

I'm interested in ''any'' patch that will give me access to the new data
and operations performed when a model's m2m field is altered. Right now,
m2m_changed is totally useless to me, and is actually '''dangerous''' as
others have pointed out in other bugs related to this one.

Me: ''Remove 2 relationships from these 200 that are set.''

Admin: ''Okay! I removed 200 things and added all 198 items back that did
not match your 2! And I sent not one single pre_remove or post_remove
signal!''

Me: ''That's not at all what I said, and it totally matters how you go
about it and that your signals+actions properly reflect what is being
asked and not reflecting how you went about doing it.''

I suspect it's no surprise that I consider this a bug, not a
"cleanup/optimization" as it's now categorized :(

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:13>

Django

unread,
Feb 20, 2012, 11:02:38 AM2/20/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: SVN
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by carljm):

* type: Cleanup/optimization => Bug


Comment:

Closed #16073 (which was specifically about incorrect m2m signals in the
admin, as a result of this) as duplicate. Marking this a bug rather than a
cleanup/optimization; previous to the existence of m2m signals it may have
been the latter, but at this point the signaling problem makes it a bug.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:14>

Django

unread,
Mar 29, 2012, 7:49:43 PM3/29/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: SVN
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by sfllaw):

* owner: nobody => sfllaw
* needs_better_patch: 1 => 0
* status: new => assigned


Comment:

6707_m2m_set.diff includes a patch that performs the minimum amount of
DELETE and INSERT statements for the {{{__set__}}} method. In addition, I
have changed {{{_add_items()}}} so it does not do an extra SELECT if
{{{__set__}}} has already removed duplicates, so we do not perform an
extra query.

This patch applies to SVN trunk.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:15>

Django

unread,
Mar 30, 2012, 6:04:47 PM3/30/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: SVN
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by sfllaw):

It occurred to me, while writing this patch, that the {{{__set__}}}
methods for ManyRelatedObjectsDescriptor and
ReverseManyRelatedObjectsDescriptor are basically the same. Should those
two Descriptors be unified into a base descriptor?

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:16>

Django

unread,
Apr 3, 2012, 2:39:34 AM4/3/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: SVN
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Bradley Ayers <bradley.ayers@…>):

* cc: bradley.ayers@… (added)


Comment:

This is fantastic, I just wanted to say thank-you very much for writing
this latest patch!

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:17>

Django

unread,
Jul 17, 2012, 1:26:49 PM7/17/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by akaariai):

I haven't tested this ticket, just skimmed the latest patch. To me it
seems this is worth getting into Django, the savings can be pretty large
if one regularly does small changes to m2m fields using list assignment.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:18>

Django

unread,
Jul 17, 2012, 1:46:23 PM7/17/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by sfllaw):

akaariai: Are there any improvements to this patch that you can suggest?

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:19>

Django

unread,
Jul 17, 2012, 1:56:49 PM7/17/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by akaariai):

Not anything I spotted immediately. As said, I haven't gone through this
in full detail. If you can get somebody to review the patch it would of
course be a plus.

I will try to get time to work on this. I can't promise anything, though.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:20>

Django

unread,
Jul 17, 2012, 2:05:31 PM7/17/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by sfllaw):

It'd be great to get a core developer to look at whether the suggested
refactoring above would be sensible.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:21>

Django

unread,
Aug 14, 2012, 3:33:39 PM8/14/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by fcurella):

* cc: flavio.curella@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:22>

Django

unread,
Nov 19, 2012, 6:24:36 AM11/19/12
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by bberes):

* cc: botondus@… (added)


Comment:

Ran into this as well on multiple occasions.
This basically makes the m2m_changed signal almost useless :(

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:23>

Django

unread,
Apr 11, 2013, 10:26:02 AM4/11/13
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by ivan_virabyan):

As I understand there is currently no way to determine which values were
added to many2many field in the admin?

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:24>

Django

unread,
Sep 2, 2013, 7:47:11 AM9/2/13
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by rickvanderzwet):

* cc: info@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:25>

Django

unread,
Nov 20, 2013, 9:47:38 AM11/20/13
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by a.krille@…):

Any news on this?

We too are bidden by this bug (and it is a bug when a signal is documented
but never actually emitted) and would love to see a proper fix.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:26>

Django

unread,
Dec 2, 2013, 1:24:41 PM12/2/13
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by MarkusH):

* cc: info@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:27>

Django

unread,
Mar 26, 2014, 5:48:09 AM3/26/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

This bug was opened "6 years ago" and we are still around the "patch".
What would it take to get this fixed?

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:28>

Django

unread,
Mar 26, 2014, 3:46:36 PM3/26/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: sfllaw
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

Shouldn't at least the documentation for previous versions including
version 1.6 be updated to not include the pre_remove and post_remove
actions in the m2m-changed signal?

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:29>

Django

unread,
Mar 26, 2014, 11:55:09 PM3/26/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic84

Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by loic84):

* owner: sfllaw => loic84


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:30>

Django

unread,
Apr 4, 2014, 12:31:04 PM4/4/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic84
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

Bitten too.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:31>

Django

unread,
Apr 4, 2014, 12:36:05 PM4/4/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic84
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by loic84):

* needs_better_patch: 0 => 1
* needs_tests: 0 => 1
* needs_docs: 0 => 1


Comment:

There's no documentation yet and I still want to add more tests, but the
latest effort for this issue is at
https://github.com/django/django/pull/2500.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:32>

Django

unread,
Sep 26, 2014, 4:24:43 PM9/26/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0

Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by loic):

* owner: loic84 => loic
* needs_docs: 1 => 0
* needs_tests: 1 => 0


Comment:

Resuming work on this issue, I brought the branch up-to-date and drafted
some documentation. It'd be very helpful if some of those affected by this
issue could give it a try.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:33>

Django

unread,
Dec 2, 2014, 4:21:39 PM12/2/14
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 1
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by nlundquist):

I've tested the branch Loic has worked on and my primary issue still
remains. m2m_changed is not triggered when the relationship is altered via
a StackInline admin form.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:34>

Django

unread,
Jan 26, 2015, 12:34:07 PM1/26/15
to django-...@googlegroups.com
#6707: Another implementation for ReverseManyRelatedObjectsDescriptor.__set__
method
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by collinanderson):

* cc: cmawebsite@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:35>

Django

unread,
Jan 26, 2015, 4:42:55 PM1/26/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data

-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:36>

Django

unread,
Jan 29, 2015, 1:23:48 PM1/29/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by loic):

I've rebased the PR and I'm quite happy with the result.

I checked regarding comment:34 and indeed when M2M are displayed as admin
inlines `m2m_changed` isn't triggered. It's because the M2M field is
bypassed and the `through` table is seen by the admin as a normal model
with 2 FKs. That's an orthogonal problem but I added docs about it in the
PR.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:37>

Django

unread,
Jan 29, 2015, 1:31:26 PM1/29/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by loic):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:38>

Django

unread,
Feb 5, 2015, 12:47:58 AM2/5/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Loic Bistuer <loic.bistuer@…>):

In [changeset:"9d104a21e20f9c5ec41d19fd919d0e808aa13dba"]:
{{{
#!CommitTicketReference repository=""
revision="9d104a21e20f9c5ec41d19fd919d0e808aa13dba"
Documented that m2m_changed isn't triggered when M2M is displayed as admin
inline.

Refs #6707.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:40>

Django

unread,
Feb 5, 2015, 12:47:58 AM2/5/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Loic Bistuer <loic.bistuer@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"71ada3a8e689a883b5ffdeb1744ea16f176ab730"]:
{{{
#!CommitTicketReference repository=""
revision="71ada3a8e689a883b5ffdeb1744ea16f176ab730"
Fixed #6707 -- Added RelatedManager.set() and made descriptors' __set__
use it.

Thanks Anssi Kääriäinen, Carl Meyer, Collin Anderson, and Tim Graham for
the reviews.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:39>

Django

unread,
Feb 5, 2015, 5:32:13 AM2/5/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Loic Bistuer <loic.bistuer@…>):

In [changeset:"20eb51ce0ddcb8d5fdc772fc2839fefef5b28c2a"]:
{{{
#!CommitTicketReference repository=""
revision="20eb51ce0ddcb8d5fdc772fc2839fefef5b28c2a"
Fix small regression caused by 71ada3a8e689a883b5ffdeb1744ea16f176ab730.

During direct assignment, evaluating the iterable before the transaction
is started avoids leaving the transaction dirty if an exception is raised.
This is slightly more wasteful but probably not enough to warrant a change
of behavior.

Thanks Anssi for the feedback. Refs #6707.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:41>

Django

unread,
Jun 5, 2015, 10:57:08 AM6/5/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by psychok7):

@Loic is this commit going to be released for Django 1.7 still ??? I am
using Django 1.7.8 and i noticed that its not there yet

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:42>

Django

unread,
Jun 5, 2015, 11:09:36 AM6/5/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by collinanderson):

@psychok7 this is actually considered more of a new feature /
optimization, so it's not backported to 1.7. It actually missed the
deadline for getting into 1.8 by a few weeks, but it will be in 1.9 which
comes out towards the end of the year.

--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:43>

Django

unread,
Dec 12, 2015, 7:04:09 AM12/12/15
to django-...@googlegroups.com
#6707: ManyToManyField clears and recreates all data
-------------------------------------+-------------------------------------
Reporter: favo <favo@…> | Owner: loic
Type: Bug | Status: closed
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by toracle):

* cc: toracle@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/6707#comment:44>

Reply all
Reply to author
Forward
0 new messages