I was kind of trying to see similar questions (Django accessing ManyToMany fields from post_save signal), but still don't see how to get the updated related objects list.
E.g. I have following models
class User(models.Model):
username = models.CharField
class Blog(models.Model):
user = models.ManyToManyField('User')
Now I am adding a user to a given blog, via django admin.
So I expect that the signal below, will print all new users (which I have just added)... but... I am getting the old list all the time :(
@receiver(m2m_changed, sender=Blog.users.through)
def blog_users_change(sender, instance, **kwargs):
print instance.users.all()
The last line gives old list of users instance.users.all()
. E.g. users added here are not reflected.