diff --git a/borrowing_service/signals.py b/borrowing_service/signals.py index ca1f12e..3f46cba 100644 --- a/borrowing_service/signals.py +++ b/borrowing_service/signals.py @@ -10,6 +10,7 @@ @receiver(post_save, sender=Borrowing) def notify_new_borrowing(sender, instance, created, **kwargs): if created: +<<<<<<< HEAD borrowing_info = ( "New borrowing created:\n\n" f"-Book: {instance.book}\n" @@ -20,3 +21,18 @@ def notify_new_borrowing(sender, instance, created, **kwargs): TelegramUser.objects.get(user_id=instance.user.pk).chat_id, borrowing_info ) +======= + try: + borrowing_info = ( + "New borrowing created:\n\n" + f"-Book: {instance.book}\n" + f"--Borrow date: {instance.borrow_date}\n" + f"--Expected return date: {instance.expected_return_date}\n" + ) + send_notification( + TelegramUser.objects.get(user_id=instance.user_id).chat_id, + borrowing_info + ) + except TelegramUser.DoesNotExist: + pass +>>>>>>> 613219309799928dfc2b508eb819b8f5992cafd6