From: Guillaume Pellerin Date: Sun, 14 Nov 2021 17:58:53 +0000 (+0100) Subject: add period arg X-Git-Tag: 2.5.0~44 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=b692f8a89cb078689e10b3e35c09d3d1203d1957;p=teleforma.git add period arg --- diff --git a/teleforma/management/commands/teleforma-import-conferences-create-2.py b/teleforma/management/commands/teleforma-import-conferences-create-2.py index dc50bf05..c83e1d36 100644 --- a/teleforma/management/commands/teleforma-import-conferences-create-2.py +++ b/teleforma/management/commands/teleforma-import-conferences-create-2.py @@ -35,7 +35,8 @@ class Command(BaseCommand): def handle(self, *args, **options): organization_name = args[0] department_name = args[1] - log_file = args[2] + period_name = args[2] + log_file = args[3] logger = Logger(log_file) organization = Organization.objects.get(name=organization_name) @@ -64,12 +65,17 @@ class Command(BaseCommand): path = dir + os.sep + filename collection_id = '_'.join([department_name, course_id, course_type]) - courses = Course.objects.filter(code=course_id) conferences = Conference.objects.filter(public_id=public_id) if conferences: conference = conferences[0] else: - course = courses[0] + courses = Course.objects.filter(code=course_id) + course_type_obj = CourseType.objects.get(name=course_type) + period_obj = Period.objects.get(name=period_name) + mtime = os.path.getmtime(path) + conf_datetime = datetime.datetime.fromtimestamp(mtime) + + course_obj = courses[0] conference = Conference(public_id=public_id) conference.course = course_obj conference.course_type = course_type_obj