The only other way that I could think to do it would be to write your own
M2M object. Just an object with two foreign key fields to reference X and
Y. In that object you could overwrite the save method to check for which
relations currently exist for a given reference to X and update
accordingly. I'm not sure this would work for you, but it might be an
alternative, although it violates the DRY principle.

Furbee

On Thu, Jan 12, 2012 at 9:20 AM, Jeff <jbla...@mitre.org> wrote:

>
> On Jan 11, 9:23 pm, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
> > On Wed, 11 Jan 2012 17:26:44 +0000, Tom Evans <tevans...@googlemail.com>
> > wrote:
> >
> > >On Wed, Jan 11, 2012 at 5:22 PM, Jeff <jbla...@mitre.org> wrote:
> > >> When Device.netgroups (a M2M field) changes, we need to perform
> > >> some python-ldap operations.
> >
> > >Have you considered simply going back to the database to check what
> > >the values currently are? It would be inefficient, but clean and
> > >concise.
> >
> >         I've forgotten how many means of changing this data there are,
> > but...
>
> Dennis,
>
> Several.
>
> A web-only solution won't work.
>
> I found the 'm2m_changed' signal yesterday, read that you can't
> determine *what* changed by using it, and also ended up directed
> to some open bug reports... etc... and threw up my hands.
>
> To the best of my digging, there is no way to accurately tell
> in SomeModel.save() whether the previous value of MyM2MField
> and the new value are the same, and/or what the differences
> are.
>
> I ended up completely restructuring stuff (I'll spare you the
> details) so that I can just say "whatever .netgroups looks
> like AFTER save, make LDAP look exactly like that."  This
> is essentially what Tom Evans suggested in his reply.  It's
> inefficient, and clearly a workaround, but is at least doable.
>
> It boils down in LDAP-terms to saying "replace all attribute
> values for X with the following full data.  I don't care what
> your old data was."  ... instead of saying, "remove value Y
> from the 1000 values set on X"  :|
>
> Thank you all for your efforts to help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to