Skip to content
Snippets Groups Projects
Commit d1af59cf authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Allow filtering for own lessons as teacher

parent 750ff75a
No related branches found
No related tags found
1 merge request!301New data model based on calendar events
Pipeline #171092 failed
...@@ -1540,6 +1540,7 @@ class LessonEvent(CalendarEvent): ...@@ -1540,6 +1540,7 @@ class LessonEvent(CalendarEvent):
type_ = params.get("type", None) type_ = params.get("type", None)
not_amended = params.get("not_amended", False) not_amended = params.get("not_amended", False)
not_amending = params.get("not_amending", False) not_amending = params.get("not_amending", False)
own = params.get("own", False)
if not_amended: if not_amended:
objs = objs.not_amended() objs = objs.not_amended()
...@@ -1547,6 +1548,9 @@ class LessonEvent(CalendarEvent): ...@@ -1547,6 +1548,9 @@ class LessonEvent(CalendarEvent):
if not_amending: if not_amending:
objs = objs.not_amending() objs = objs.not_amending()
if own and has_person(request.user):
objs = objs.for_teacher(request.user.person.id)
if type_ and obj_id: if type_ and obj_id:
if type_ == "TEACHER": if type_ == "TEACHER":
return objs.for_teacher(obj_id) return objs.for_teacher(obj_id)
...@@ -1556,6 +1560,7 @@ class LessonEvent(CalendarEvent): ...@@ -1556,6 +1560,7 @@ class LessonEvent(CalendarEvent):
return objs.for_room(obj_id) return objs.for_room(obj_id)
elif type_ == "COURSE": elif type_ == "COURSE":
return objs.for_course(obj_id) return objs.for_course(obj_id)
return objs
return objs.for_person(request.user.person) return objs.for_person(request.user.person)
class Meta: class Meta:
......
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