[FIX] PMS: Fixed meetings can be created in past dates

This commit is contained in:
Horilla
2024-07-23 11:10:25 +05:30
parent 12f362b07f
commit ba9c10b784

View File

@@ -1043,6 +1043,13 @@ class MeetingsForm(BaseForm):
ids = self.data.getlist("employee_id")
if ids:
self.errors.pop("employee_id", None)
if (
cleaned_data["date"].date() <= datetime.datetime.now().date()
and cleaned_data["date"].time() < datetime.datetime.now().time()
):
raise ValidationError("Date and time cannot be in the past")
return cleaned_data
def __init__(self, *args, **kwargs):