[FIX] ATTENDANCE: Grace time creation bug

This commit is contained in:
Horilla
2024-01-17 14:19:11 +05:30
parent 651ca3cfe6
commit 903ecb35b8
3 changed files with 14 additions and 5 deletions

View File

@@ -944,7 +944,7 @@ class GraceTime(models.Model):
raise ValidationError(_("There is already a default grace time that exists."))
allowed_time = self.allowed_time
if GraceTime.objects.filter(allowed_time=allowed_time).exclude(is_default=True).exists():
if GraceTime.objects.filter(allowed_time=allowed_time).exclude(is_default=True).exclude(id=self.id).exists():
raise ValidationError(_("There is already a grace time with this allowed time that exists."))
def save(self, *args, **kwargs):