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

Update newly created documentations as well

parent 726e20f2
No related branches found
No related tags found
1 merge request!356Add dialog for creation of long-term absences
...@@ -98,30 +98,30 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation): ...@@ -98,30 +98,30 @@ class DocumentationBatchCreateOrUpdateMutation(graphene.Mutation):
# Sadly, we can't use the update_or_create method since create_defaults # Sadly, we can't use the update_or_create method since create_defaults
# is only introduced in Django 5.0 # is only introduced in Django 5.0
if _id.startswith("DUMMY"): if _id.startswith("DUMMY"):
return Documentation.create_from_lesson_event( obj = Documentation.create_from_lesson_event(
info.context.user, info.context.user,
*Documentation.parse_dummy(_id), *Documentation.parse_dummy(_id),
) )
else: else:
obj = Documentation.objects.get(id=_id) obj = Documentation.objects.get(id=_id)
if not info.context.user.has_perm("alsijil.edit_documentation_rule", obj): if not info.context.user.has_perm("alsijil.edit_documentation_rule", obj):
raise PermissionDenied() raise PermissionDenied()
if doc.topic is not None: if doc.topic is not None:
obj.topic = doc.topic obj.topic = doc.topic
if doc.homework is not None: if doc.homework is not None:
obj.homework = doc.homework obj.homework = doc.homework
if doc.group_note is not None: if doc.group_note is not None:
obj.group_note = doc.group_note obj.group_note = doc.group_note
if doc.subject is not None: if doc.subject is not None:
obj.subject = Subject.objects.get(pk=doc.subject) obj.subject = Subject.objects.get(pk=doc.subject)
if doc.teachers is not None: if doc.teachers is not None:
obj.teachers.set(Person.objects.filter(pk__in=doc.teachers)) obj.teachers.set(Person.objects.filter(pk__in=doc.teachers))
obj.save() obj.save()
return obj return obj
@classmethod @classmethod
def mutate(cls, root, info, input): # noqa def mutate(cls, root, info, input): # noqa
......
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