Use the new generic "get_natural_key" method
authorymh <ymh.work@gmail.com>
Tue, 26 Jun 2018 16:22:54 +0200
changeset 21 631f70f55fed
parent 20 a07ea7805cc4
child 22 b6d788cd06f1
Use the new generic "get_natural_key" method
src/iconolab_mcc/management/commands/importimages.py
--- a/src/iconolab_mcc/management/commands/importimages.py	Thu Jul 05 12:43:26 2018 +0200
+++ b/src/iconolab_mcc/management/commands/importimages.py	Tue Jun 26 16:22:54 2018 +0200
@@ -343,7 +343,7 @@
                 item_photo_credits = item['PHOT']
                 item_inventory_number = item['INV']
                 item_joconde_ref = item['REF']
-                natural_key="%s|%s" % (collection.name,item_joconde_ref)
+                natural_key = ItemMetadata.get_natural_key(collection, item_joconde_ref)
                 if ItemMetadata.objects.filter(item__collection=collection, natural_key=natural_key).exists():
                     print('#### An item with ' +
                           item['REF']+' for natural key, already exists in database in the import collection')