-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91e2aff
commit 18ae302
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |