Skip to content

Commit

Permalink
add NotifyMixin
Browse files Browse the repository at this point in the history
  • Loading branch information
HesamKorki committed Oct 20, 2023
1 parent 91e2aff commit 18ae302
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions notification/__init__.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 18ae302

Please sign in to comment.