From 7dc4902419c8b8e474432435bba19e09348538f0 Mon Sep 17 00:00:00 2001 From: geoffroy-noel-ddh Date: Mon, 21 Aug 2017 01:43:18 +0100 Subject: [PATCH] Bugfix AC MOA #21: the dates migration should convert special x symbol into x letter. --- digipal/management/commands/dpmigrate.py | 5 +++-- digipal/utils.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/digipal/management/commands/dpmigrate.py b/digipal/management/commands/dpmigrate.py index bd8b930ee..7fd22e23e 100644 --- a/digipal/management/commands/dpmigrate.py +++ b/digipal/management/commands/dpmigrate.py @@ -278,10 +278,11 @@ def move_hi_dates_to_text(self): item_itempart.save() print 'Created' for text in texts.all(): - text.date = hi.date + text.date = hi.date.replace(u'×', u'x') text.date_sort = hi.date_sort - print ur'Move %s from HI #%s to Text #%s' % (hi.date, hi.id, ip.id) + print ur'Move %s from HI #%s to Text #%s' % (text.date, hi.id, ip.id) text.save() + print dputils.get_range_from_date(text.date) hi.date = None hi.date_sort = None hi.save() diff --git a/digipal/utils.py b/digipal/utils.py index 5b77cebd7..8108de299 100644 --- a/digipal/utils.py +++ b/digipal/utils.py @@ -658,6 +658,7 @@ def get_range_from_date(str): if str is not None and is_max_date_range(ret): # circa 1221 x circa 1247 + str = str.replace(u'×', u'x') if 'x' in str: parts = str.split('x') if len(parts) == 2: