8

I set a receiver on a post_save signal and I was hoping catching the signals for all the proxy of my Model by setting the sender to the main Model but it does not seem to work:

class MyObject(models.Model):
    ....

class MyObjectProxy(MyObject):

    class Meta:
        proxy = True

# The receiver
# How to avoid writing another one for sender=MyObjectProxy ?
@receiver(post_save, sender=MyObject)
...

My receiver is not triggered when that happens:

obj = MyObjectProxy()
obj.save()

Is that normal? I have to set a receiver for each proxy? Can I set sender to a list of models?

Thanks.

Michael
  • 8,357
  • 20
  • 58
  • 86

1 Answers1

2

As of now, I think that a list of models is the only working way. There is an open discussion about that specific issue.

Germano
  • 2,452
  • 18
  • 25