Skip to content
Snippets Groups Projects
Commit f1d0c49e authored by Julian's avatar Julian Committed by permcu
Browse files

Create participations when creating documentations

parent 34d18507
No related branches found
No related tags found
1 merge request!356Add dialog for creation of long-term absences
...@@ -678,6 +678,24 @@ class Documentation(CalendarEvent): ...@@ -678,6 +678,24 @@ class Documentation(CalendarEvent):
) )
obj.teachers.set(teachers.all()) obj.teachers.set(teachers.all())
obj.save() obj.save()
# Create Participation Statuses
# Cannot use djangos bulk_create method, as then the save method of the
# superclass wouldn't be called
for member in lesson_event.all_members:
# TODO: Check for preexisting absences in kolego
# TODO: maybe only create if the lesson start is in the past
status = ParticipationStatus.objects.create(
person=member,
related_documentation=obj,
datetime_start=datetime_start,
datetime_end=datetime_end,
timezone=lesson_event.timezone,
)
status.groups_of_person.set(member.member_of.all())
status.save()
return obj return obj
@classmethod @classmethod
......
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