Skip to content
Snippets Groups Projects
Unverified Commit 5e8efdcb authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Implement function to get all currently running lessons.

Advances BiscuIT-App-Alsijil#1.
parent 8eb432af
No related branches found
No related tags found
No related merge requests found
from datetime import datetime from datetime import datetime
from .models import LessonPeriod
def current_week(): def current_week():
return int(datetime.now().strftime('%V')) return int(datetime.now().strftime('%V'))
def current_lesson_periods(when=None):
now = when or datetime.now()
return LessonPeriod.objects.filter(lesson__date_start__lte=now.date(),
lesson__date_end__gte=now.date(),
period__weekday=now.isoweekday(),
period__time_start__lte=now.time(),
period__time_end__gte=now.time())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment