equal
deleted
inserted
replaced
341 item_discovery_context = item['DECV'] |
341 item_discovery_context = item['DECV'] |
342 item_conservation_location = item['LOCA'] |
342 item_conservation_location = item['LOCA'] |
343 item_photo_credits = item['PHOT'] |
343 item_photo_credits = item['PHOT'] |
344 item_inventory_number = item['INV'] |
344 item_inventory_number = item['INV'] |
345 item_joconde_ref = item['REF'] |
345 item_joconde_ref = item['REF'] |
346 if ItemMetadata.objects.filter(item__collection=collection, natural_key=item_joconde_ref).exists(): |
346 natural_key="%s|%s" % (collection.name,item_joconde_ref) |
|
347 if ItemMetadata.objects.filter(item__collection=collection, natural_key=natural_key).exists(): |
347 print('#### An item with ' + |
348 print('#### An item with ' + |
348 item['REF']+' for natural key, already exists in database in the import collection') |
349 item['REF']+' for natural key, already exists in database in the import collection') |
349 |
350 |
350 if options['import_folders']: |
351 if options['import_folders']: |
351 |
352 |
364 else: |
365 else: |
365 print('#### Folder "'+folder_id+'" already exists') |
366 print('#### Folder "'+folder_id+'" already exists') |
366 folder = Folder.objects.get(original_id=folder_id) |
367 folder = Folder.objects.get(original_id=folder_id) |
367 |
368 |
368 item_metadata = ItemMetadata.objects.get( |
369 item_metadata = ItemMetadata.objects.get( |
369 item__collection=collection, natural_key=item_joconde_ref) |
370 item__collection=collection, natural_key=natural_key) |
370 item = item_metadata.item |
371 item = item_metadata.item |
371 |
372 |
372 item.folders.add(folder) |
373 item.folders.add(folder) |
373 |
374 |
374 else: |
375 else: |
386 "photo_credits" : item_photo_credits, |
387 "photo_credits" : item_photo_credits, |
387 "inventory_number" : item_inventory_number, |
388 "inventory_number" : item_inventory_number, |
388 "joconde_ref" : item_joconde_ref |
389 "joconde_ref" : item_joconde_ref |
389 } |
390 } |
390 self.create_item_and_metadata( |
391 self.create_item_and_metadata( |
391 item_joconde_ref, collection, new_metadata, item['SRC_IMG_FILES'], options, self.source_dir) |
392 natural_key, collection, new_metadata, item['SRC_IMG_FILES'], options, self.source_dir) |
392 |
393 |
393 print('# All done!') |
394 print('# All done!') |
394 |
395 |
395 logger.debug('# Recap for import command: ') |
396 logger.debug('# Recap for import command: ') |
396 print('# Images without data: ') |
397 print('# Images without data: ') |