Recently I've been trying to get answers about the post_save signal
behavior and perhaps have been asking too much of readers without
narrowing down the problem enough myself. So here is my effort to ask
a rather straightforward question:

The code that connects to the post_save signal, according to the
signal docs, is passed three objects and I am only concerned about
one: the instance that was saved. Now this instance has a
ManyToManyField and what I am finding out according to be debugging is
that the instance's ManyToMany field is NOT being updated after save
is called.

So, for example, when the signal calls the handler (this is being done
via the admin interface but it shouldn't matter) and I check
instance.manytomanyfield, it does not show the most recent changes.
What is the best way to "force" the update of the table so I can get
accurate data from the ManyToMany field? Even if I explicitly do
something like this:

    def __init__(self, sender, instance):
        self.sender = sender
        self.instance = sender.objects.select_related().get
(id=instance.id)

What seems like cached data is being when I test:

self.instance.manytomanyfield.all()

Can anyone help with this behavior?

Cheers,
Ryan
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to