def receiver(signal, **kwargs):
def _decorator(func):<EOL><INDENT>if isinstance(signal, (list, tuple)):<EOL><INDENT>for s in signal:<EOL><INDENT>s.connect(func, **kwargs)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>signal.connect(func, **kwargs)<EOL><DEDENT>return func<EOL><DEDENT>return _decorator<EOL>
A decorator for connecting receivers to signals. Used by passing in the
signal (or list of signals) and keyword arguments to connect::

    @receiver(post_save, sender=MyModel)
    def signal_receiver(sender, **kwargs):
        ...

    @receiver([post_save, post_delete], sender=MyModel)
    def signals_receiver(sender, **kwargs):
        ...