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

Allow filtering for amended and amending LessonEvents in get_objects

parent 4a7d8da4
No related branches found
No related tags found
1 merge request!301New data model based on calendar events
Pipeline #170437 failed
......@@ -902,3 +902,9 @@ class LessonEventQuerySet(PolymorphicQuerySet):
return self.filter(
Q(teachers=person) | Q(groups__members=person) | Q(pk__in=amended)
).distinct()
def not_amended(self):
return self.filter(amended_by__isnull=True)
def not_amending(self):
return self.filter(amends__isnull=True)
......@@ -1538,6 +1538,14 @@ class LessonEvent(CalendarEvent):
if params:
obj_id = int(params.get("id", 0))
type_ = params.get("type", None)
not_amended = params.get("not_amended", False)
not_amending = params.get("not_amending", False)
if not_amended:
objs = objs.not_amended()
if not_amending:
objs = objs.not_amending()
if type_ and obj_id:
if type_ == "TEACHER":
......
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