11 lines
379 B
Python
11 lines
379 B
Python
|
import datetime
|
||
|
|
||
|
from flask import abort
|
||
|
from ..examination_schedule.models import ExaminationSchedule
|
||
|
|
||
|
|
||
|
def check_the_enrollments_has_just_started(es: ExaminationSchedule) -> None:
|
||
|
now = datetime.datetime.utcnow()
|
||
|
if es.start_date is None or es.end_date is None or not (es.start_date < now < es.end_date):
|
||
|
abort(403, "Forbidden! Enrollment hasn't started yet.")
|