Skip to content

Commit 022442c

Browse files
author
Mathieu Dupuy
committed
Appointment: raise ValidationError instead of ValueError in clean()
1 parent 6042b30 commit 022442c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

appointment/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,9 @@ def __str__(self):
311311
def clean(self):
312312
if self.start_time is not None and self.end_time is not None:
313313
if self.start_time >= self.end_time:
314-
raise ValueError(_("Start time must be before end time"))
314+
raise ValidationError(_("Start time must be before end time"))
315315
if self.start_time == self.end_time:
316-
raise ValueError(_("Start time and end time cannot be the same"))
316+
raise ValidationError(_("Start time and end time cannot be the same"))
317317
# Check for valid date
318318
try:
319319
# This will raise a ValueError if the date is not valid

0 commit comments

Comments
 (0)