views:

25

answers:

0

I am using a post_save signal on an instance.

In the callback I would like to add elements to the ManyToManyField of this very instance (named 'locales'). Here is my code:

def after_insertion(sender, instance, **kwargs):
    locale = Locale(locale='en')
    locale.save()
    instance.locales.add(locale)

Locale instance is created but not added to the ManyToManyObjectsManager.

What am I doing wrong ?

Any ideas or suggestions will be appreciated

Thanks