On Wed, Sep 23, 2009, M Godshall <[email protected]> wrote: > >I have a Project model with a ManyToManyField called "members" to keep >track of members of a project. Whenever the model is updated, I need >to check if certain members need to be removed from or added to the >m2m field.
I am trying to do exactly the same thing as you (see the concurrent thread "verriding save() for ManyToManyFields"). I am not having much luck. So far I have ascertained that m2m fields *don't* need otb esaved to be updated, but, like you: > The most logical place to do this is in the model's custom >save method, but when I try to save the model in the admin the members >field reverts to its previous state even after running >self.members.remove(user1) and self.members.add(user2). It appears that they have changed, but the changes don't seem to get to the database. > From what I >have researched and tested so far, if you save a project from a front- >end view, the m2m field updates without reverting to its previous >state, but I really need this functionality when a model is saved in >the admin as well. I have not seen anything to suggest that an admin save won't trigger this, but whether I use a post_save signal, or try to do it in the save () override, it fails to stick. I really can't work out why it's failing to stick. Daniele --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

