fairdm.contrib.contributors.forms.contribution#
Forms for adding people and editing contributions.
Module Contents#
Classes#
Create a person by ORCID lookup or by entering their details. |
|
Edit a contribution’s roles and affiliation. |
API#
- class PersonCreateForm(*args, **kwargs)#
Bases:
fairdm.forms.ModelFormCreate a person by ORCID lookup or by entering their details.
Only the fields of the submitted
action(from_orcidorfrom_form) are required.Args: *args: Passed to
ModelForm. **kwargs: Passed toModelForm.Attributes: from_orcid: The ORCID iD to look up. affiliations: The person’s organisation. is_primary: Whether the affiliation is primary. is_current: Whether the affiliation is current.
Initialization
- from_orcid#
‘CharField(…)’
- affiliations#
‘OrganizationChoiceField(…)’
- is_primary#
‘BooleanField(…)’
- is_current#
‘BooleanField(…)’
- class Meta#
- model#
None
- fields#
[‘from_orcid’, ‘name’, ‘first_name’, ‘last_name’, ‘affiliations’, ‘is_primary’, ‘is_current’]
- help_texts#
None
- clean_first_name()#
Require a first name when adding manually.
- clean_last_name()#
Require a last name when adding manually.
- clean_affiliations()#
Require an affiliation when adding manually.
- clean_from_orcid()#
Require an ORCID iD when searching ORCID.
- save(commit=True)#
Create the person from ORCID, or save the entered details and their affiliation.
- class UpdateContributionForm(*args, **kwargs)#
Bases:
fairdm.forms.ModelFormEdit a contribution’s roles and affiliation.
Roles are limited to those the credited object allows, and affiliations to the contributor’s own.
Args: *args: Passed to
ModelForm. **kwargs: Passed toModelFormafter removingbase_object, the credited object.Attributes: roles: The roles held. affiliation: The contributor’s affiliation for this credit.
Initialization
- roles#
‘ModelMultipleChoiceField(…)’
- affiliation#
‘ModelChoiceField(…)’