Skip to content

Commit

Permalink
Add notification on update of lending instance
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasdeluna committed Mar 12, 2024
1 parent ab09ba5 commit e379fb9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lego/apps/lending/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ def create(self, *args, **kwargs):
notification.notify()

return lending_instance

#TODO: We probably need another template for accepting instances
def update(self, *args, **kwargs):
from lego.apps.lending.notifications import LendingInstanceNotification

lending_instance = super().update(*args, **kwargs)
notification = LendingInstanceNotification(
lending_instance=lending_instance,
user=lending_instance.created_by,
)
notification.notify()

return lending_instance


def get_queryset(self):
return super().get_queryset().select_related("created_by")
Expand Down

0 comments on commit e379fb9

Please sign in to comment.