fairdm.contrib.contributors.resources#
django-import-export resource for importing people from a spreadsheet.
Module Contents#
Classes#
Import people, their ORCID iD and their affiliation from a spreadsheet. |
API#
- class PersonResource(**kwargs)#
Bases:
import_export.resources.ModelResourceImport people, their ORCID iD and their affiliation from a spreadsheet.
Attributes: orcid: The person’s ORCID iD. ror_id: The ROR id of the person’s affiliation. affiliation: The name of the person’s affiliation. uuid: The row’s identifier, used to find the person but never written.
Initialization
kwargs: An optional dict of kwargs. Subclasses can use kwargs to pass dynamic values to enhance import / exports.
- orcid#
‘Field(…)’
- ror_id#
‘Field(…)’
- affiliation#
‘Field(…)’
- uuid#
‘Field(…)’
- class Meta#
- model#
None
- import_id_fields#
[‘uuid’]
- skip_unchanged#
True
- use_transactions#
True
- skip_admin_log#
True
- fields#
(‘uuid’, ‘name’, ‘first_name’, ‘last_name’, ‘orcid’, ‘ror_id’, ‘affiliation’)
- after_save_instance(instance, row, **kwargs)#
Link the person to their affiliation’s organisation, creating it if needed.
- get_instance(instance_loader, row)#
Resolve the row to an existing person, or None so a new one is created.
Args: instance_loader: The import-export instance loader. row: The spreadsheet row.
Returns: The matching or newly created person, or None for a new row.
Raises: ValidationError: The row matches an already-claimed person, which an import must not overwrite.