diff options
Diffstat (limited to 'archaeological_operations/import_from_csv.py')
-rw-r--r-- | archaeological_operations/import_from_csv.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/archaeological_operations/import_from_csv.py b/archaeological_operations/import_from_csv.py index 41f322dc4..790f0e078 100644 --- a/archaeological_operations/import_from_csv.py +++ b/archaeological_operations/import_from_csv.py @@ -116,10 +116,18 @@ def parse_period(value): break return period +_REPLACED_PERIOD = [('deuxieme', 'second')] +_REPLACED_PERIOD += [(y, x) for x, y in _REPLACED_PERIOD] +REPLACED_PERIOD_DCT = dict(_REPLACED_PERIOD) + period_names = {} for k in settings.ISHTAR_PERIODS.keys(): period = Period.objects.get(txt_idx=settings.ISHTAR_PERIODS[k]) - period_names[slugify(period.label)] = period + slug = slugify(period.label) + period_names[slug] = period + for k in REPLACED_PERIOD_DCT.keys(): + if k in slug: + period_names[slug.replace(k, REPLACED_PERIOD_DCT[k])] = period period_names_keys = period_names.keys() period_names_keys.sort(key=len) period_names_keys.reverse() |