Commit 0ad59e43c549817cece3f7846c0cec10881687a2
1 parent
806d79e4
Exists in
dev
fix & improve import of seq file
Showing
2 changed files
with
12 additions
and
4 deletions
Show diff stats
src/core/pyros_django/routine_manager/functions.py
... | ... | @@ -45,9 +45,12 @@ def check_sequence_file_validity(yaml_content,request): |
45 | 45 | value = yaml_content["sequence"][field]["values"][index_value] |
46 | 46 | else: |
47 | 47 | if field == "start_date": |
48 | - value = datetime.datetime.strptime(yaml_content["sequence"][field]["value"],'%d/%m/%Y %H:%M:%S') | |
49 | - seq.__dict__[field] = value | |
50 | - continue | |
48 | + if type(yaml_content["sequence"][field]["value"]) != datetime.datetime: | |
49 | + #value = datetime.datetime.strptime(yaml_content["sequence"][field]["value"],'%d/%m/%Y %H:%M:%S') | |
50 | + # ISO format | |
51 | + value = datetime.datetime.strptime(yaml_content["sequence"][field]["value"],'%Y-%m/%dT%H:%M:%S.%f') | |
52 | + seq.__dict__[field] = value | |
53 | + continue | |
51 | 54 | if field in seq.__dict__.keys(): |
52 | 55 | seq.__dict__[field] = value |
53 | 56 | else: |
... | ... | @@ -55,6 +58,9 @@ def check_sequence_file_validity(yaml_content,request): |
55 | 58 | |
56 | 59 | albums_from_file = yaml_content["sequence"]["ALBUMS"] |
57 | 60 | choosen_layout = seq.config_attributes["layout"] |
61 | + if type(choosen_layout) == int: | |
62 | + layouts = config.get_layouts(config.unit_name)["layouts"] | |
63 | + choosen_layout = list(layouts.keys())[choosen_layout] | |
58 | 64 | albums_of_layout = config.getLayoutByName(unit_name=config.unit_name,name_of_layout=choosen_layout)["ALBUMS"] |
59 | 65 | if len(albums_of_layout) == len(albums_from_file): |
60 | 66 | for album in albums_from_file: | ... | ... |
src/core/pyros_django/routine_manager/views.py
... | ... | @@ -888,7 +888,9 @@ def export_sequence(request, seq_id: int, type: str): |
888 | 888 | field_dict["value_type"] = "int" |
889 | 889 | |
890 | 890 | elif field == "start_date": |
891 | - field_dict["value"] = seq.start_date.strftime("%d/%m/%Y %H:%M:%S") | |
891 | + #field_dict["value"] = seq.start_date.strftime("%d/%m/%Y %H:%M:%S") | |
892 | + # ISO format | |
893 | + field_dict["value"] = seq.start_date.strftime("Y-%m/%dT%H:%M:%S.%f") | |
892 | 894 | field_dict["value_type"] = "str" |
893 | 895 | else: |
894 | 896 | field_dict["value_type"] = sequence_form.fields[field].widget.input_type | ... | ... |