34

I've written some signals in my Django app that are supposed to send out an email when a particular model instance is created or modified, but the signal receiver function doesn't seem to be responding; at any rate, I'm not getting any emails through (although I have already checked that I'm able to send emails with my current configuration).

Anyhow; I wondered, is it possible to manually send a post_save signal for debugging purposes, rather than trying to trigger it by creating a new model instance each time? Thanks!

david_hughes
  • 712
  • 2
  • 7
  • 9

1 Answers1

63

Yes. See the documentation:

from django.db.models.signals import post_save

instance = MyModel(field='qwerty')
post_save.send(MyModel, instance=instance, created=True)
Artem Bernatskyi
  • 4,185
  • 2
  • 26
  • 35
catavaran
  • 44,703
  • 8
  • 98
  • 85