diff --git a/README.md b/README.md index 1567da8..6b5ca29 100644 --- a/README.md +++ b/README.md @@ -141,12 +141,18 @@ from django.dispatch import receiver from osis_notification.signals import email_notification_sent, web_notification_sent @receiver(email_notification_sent) -def email_notification_has_been_sent(sender, notification_uuid, **kwargs): - print(f"An email notification was sent from sender {sender} with the uuid {notification_uuid}") +def email_notification_has_been_sent(sender, notification, **kwargs): + print( + f"An email notification was sent from signal sender {sender} with the" + f"uuid {notification.uuid} to {notification.person}." + ) @receiver(web_notification_sent) -def web_notification_has_been_sent(sender, notification_uuid, **kwargs): - print(f"A web notification was sent from sender {sender} with the uuid {notification_uuid}") +def web_notification_has_been_sent(sender, notification, **kwargs): + print( + f"An web notification was sent from signal sender {sender} with the" + f"uuid {notification.uuid} to {notification.person}." + ) ``` ## Cleaning notifications diff --git a/management/commands/send_email_notifications.py b/management/commands/send_email_notifications.py index ec67038..f907eea 100644 --- a/management/commands/send_email_notifications.py +++ b/management/commands/send_email_notifications.py @@ -13,5 +13,5 @@ def handle(self, *args, **options): EmailNotificationHandler.process(notification) email_notification_sent.send( sender=self.__class__, - notification_uuid=notification.uuid, + notification=notification, ) diff --git a/management/commands/send_web_notifications.py b/management/commands/send_web_notifications.py index 7ae5107..e5e21e5 100644 --- a/management/commands/send_web_notifications.py +++ b/management/commands/send_web_notifications.py @@ -13,5 +13,5 @@ def handle(self, *args, **options): WebNotificationHandler.process(notification) web_notification_sent.send( sender=self.__class__, - notification_uuid=notification.uuid, + notification=notification, ) diff --git a/signals/email_notification_sent.py b/signals/email_notification_sent.py index 5f27808..0c2cb8f 100644 --- a/signals/email_notification_sent.py +++ b/signals/email_notification_sent.py @@ -1,4 +1,4 @@ from django.dispatch import Signal -email_notification_sent = Signal(providing_args=["notification_uuid"]) +email_notification_sent = Signal(providing_args=["notification"]) diff --git a/signals/web_notification_sent.py b/signals/web_notification_sent.py index 2aa8aff..800e25f 100644 --- a/signals/web_notification_sent.py +++ b/signals/web_notification_sent.py @@ -1,4 +1,4 @@ from django.dispatch import Signal -web_notification_sent = Signal(providing_args=["notification_uuid"]) +web_notification_sent = Signal(providing_args=["notification"])