def has_permission(self, request, view): start = Config.get(key='start_at') now = datetime.datetime.utcnow().replace(tzinfo=utc) if start: if start > now: raise TimeException(message="CTF isn't started.", error="NOT_STARTED") return True
def has_permission(self, request, view): end = Config.get(key='end_at') now = datetime.datetime.utcnow().replace(tzinfo=utc) if end: if end < now: raise TimeException(message="CTF closed.", error="CLOSED") return True