I want to send out an email when a model instance is saved. To do this I listen out for the post_save signal:
#models.py
@receiver(post_save, sender=MyModel, dispatch_uid="something")
def send_email(sender, **kwargs):
instance = kwargs['instance']
email = ModelsEmailMessage(instance)
email.send()
In my view I process the form and append subscribers to the object:
#views.py
object = form.save()
object.subscribers.add(*users)
My problem is that the form save triggers the post_save signal before the users have been added.
But if I do this:
object = form.save(commit=False)
then I can't add m2m instances to an object that has no id.
Heyulp!