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

Try to set class teacher.

parent 95547183
No related branches found
No related tags found
No related merge requests found
......@@ -65,10 +65,20 @@ def untis_import_xml(request, untis_xml):
for class_node in classes:
short_name = class_node.attributes['id'].value[3:]
name = _('Class %s') % short_name
class_teacher_short_name = get_child_node_id(
class_node, 'class_teacher')[3:]
class_, created = Group.objects.get_or_create(short_name=short_name, defaults={
'name': name})
try:
class_.owners = [Person.objects.get(
short_name=class_teacher_short_name)]
class_.save()
except Person.DoesNotExist:
messages.warning(request, _('Could not set class teacher of %s to %s.') % (
short_name, class_teacher_short_name))
lessons = dom.getElementsByTagName('lesson')
for lesson_node in lessons:
subject_abbrev = get_child_node_id(lesson_node, 'lesson_subject')[3:]
......
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