summaryrefslogtreecommitdiffstats
path: root/pharos-dashboard/src/notification/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'pharos-dashboard/src/notification/models.py')
-rw-r--r--pharos-dashboard/src/notification/models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pharos-dashboard/src/notification/models.py b/pharos-dashboard/src/notification/models.py
index 2d19918..0ee275d 100644
--- a/pharos-dashboard/src/notification/models.py
+++ b/pharos-dashboard/src/notification/models.py
@@ -26,7 +26,8 @@ class BookingNotification(models.Model):
}
def save(self, *args, **kwargs):
- notifications = self.booking.bookingnotification_set.filter(type=self.type)
- if notifications.count() > 1:
+ notifications = self.booking.bookingnotification_set.filter(type=self.type).exclude(
+ id=self.id)
+ if notifications.count() > 0:
raise ValueError('Doubled Notification')
return super(BookingNotification, self).save(*args, **kwargs) \ No newline at end of file