Import LIB_BRANCHE_OPTION when importing student file
This commit is contained in:
parent
68b50514a4
commit
e4a4ea46dc
4 changed files with 14 additions and 3 deletions
|
|
@ -23,7 +23,7 @@ from django.views.generic import DetailView, FormView, TemplateView, ListView
|
|||
|
||||
from .forms import PeriodForm, StudentImportForm, UploadHPFileForm
|
||||
from .models import (
|
||||
Klass, Section, Student, Teacher, Corporation, CorpContact, Course, Period,
|
||||
Klass, Section, Option, Student, Teacher, Corporation, CorpContact, Course, Period,
|
||||
Training, Availability,
|
||||
)
|
||||
from .pdf import UpdateDataFormPDF
|
||||
|
|
@ -342,6 +342,11 @@ class StudentImportView(ImportViewBase):
|
|||
seen_students_ids.add(student_defaults['ext_id'])
|
||||
if isinstance(student_defaults['birth_date'], str):
|
||||
student_defaults['birth_date'] = datetime.strptime(student_defaults['birth_date'], '%d.%m.%Y').date()
|
||||
if student_defaults['option_ase']:
|
||||
try:
|
||||
student_defaults['option_ase'] = Option.objects.get(name=student_defaults['option_ase'])
|
||||
except Option.DoesNotExist:
|
||||
del student_defaults['option_ase']
|
||||
|
||||
corporation_defaults = {
|
||||
val: strip(line[key]) for key, val in corporation_mapping.items()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue