#5390: Add signals to ManyRelatedManager
----------------------------------------------------------+-----------------
          Reporter:  Ludovico Magnocavallo <l...@qix.it>  |         Owner:  
rvdrijst                       
            Status:  assigned                             |     Milestone:  1.2 
                           
         Component:  Database layer (models, ORM)         |       Version:  SVN 
                           
        Resolution:                                       |      Keywords:  
manytomanyfield feature signals
             Stage:  Design decision needed               |     Has_patch:  1   
                           
        Needs_docs:  0                                    |   Needs_tests:  0   
                           
Needs_better_patch:  0                                    |  
----------------------------------------------------------+-----------------
Comment (by frans):

 I found that to have the expected behaviour when using the admin, I had to
 hack ReverseManyRelatedObjectsDescriptor and ManyRelatedObjectsDescriptor
 in django/db/fields/related.py to replace, in `__set__`,
 {{{
         manager = self.__get__(instance)
         manager.clear()
         manager.add(*value)
 }}}
 by
 {{{
         manager = self.__get__(instance)
         previous=set(manager.all())
         new=set(value)
         added=new-previous
         removed=previous-new
         manager.add(*added)
         manager.remove(*removed)
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5390#comment:40>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to