From 18ae302176d23188987c3247879228c353e45013 Mon Sep 17 00:00:00 2001 From: Hesam KORKI Date: Fri, 20 Oct 2023 11:58:24 +0200 Subject: [PATCH] add NotifyMixin --- notification/__init__.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/notification/__init__.py b/notification/__init__.py index e69de29b..56f53fe2 100644 --- a/notification/__init__.py +++ b/notification/__init__.py @@ -0,0 +1,26 @@ +class NotifyMixin: + def get_notification_recipients(self): + """ + Should Query the users based on their notification settings + and the entity. + + Raises: + NotImplementedError: It should be implemented by the subclass + """ + raise NotImplementedError(f"Subclasses of {NotifyMixin.__name__} must implement {self.get_notification_recipients.__name__}") + + def make_notification(self): + """ + Creates a notifications for the reciepients based on + the business logic of the entity. + + Raises: + NotImplementedError: It should be implemented by the subclass + """ + raise NotImplementedError(f"Subclasses of {NotifyMixin.__name__} must implement {self.make_notification.__name__}") + + def get_absolute_url(self): + """ + Returns the absolute url of the entity. + """ + return None \ No newline at end of file