From 966cb649e3951f87cd504ab050ebfaa964e334be Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 9 Oct 2018 19:46:51 +0200 Subject: Fix reassociate similar image command when reference is Null --- .../management/commands/reassociate_similar_images.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/management/commands/reassociate_similar_images.py b/ishtar_common/management/commands/reassociate_similar_images.py index e76f4e725..a3acfea16 100644 --- a/ishtar_common/management/commands/reassociate_similar_images.py +++ b/ishtar_common/management/commands/reassociate_similar_images.py @@ -129,11 +129,17 @@ class Command(BaseCommand): nb_conflicted_items += 1 for attr, ref_value, other_value in conflicted_values: conflicts.append([ - ref_item.pk, ref_item.reference.encode('utf-8'), - ref_item.cache_related_label.encode('utf-8'), + ref_item.pk, + ref_item.reference.encode('utf-8') if + ref_item.reference else "", + ref_item.cache_related_label.encode('utf-8') if + ref_item.cache_related_label else "", ref_item.image.name.encode('utf-8'), - item.pk, item.reference.encode('utf-8'), - item.cache_related_label.encode('utf-8'), + item.pk, + item.reference.encode('utf-8') if + item.reference else "", + item.cache_related_label.encode('utf-8') if + item.cache_related_label else "", item.image.name.encode('utf-8'), attr, unicode(ref_value).encode('utf-8'), unicode(other_value).encode('utf-8') -- cgit v1.2.3