fairdm.contrib.contributors.forms.contribution#

Forms for adding people and editing contributions.

Module Contents#

Classes#

PersonCreateForm

Create a person by ORCID lookup or by entering their details.

UpdateContributionForm

Edit a contribution’s roles and affiliation.

API#

class PersonCreateForm(*args, **kwargs)#

Bases: fairdm.forms.ModelForm

Create a person by ORCID lookup or by entering their details.

Only the fields of the submitted action (from_orcid or from_form) are required.

Args: *args: Passed to ModelForm. **kwargs: Passed to ModelForm.

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.ModelForm

Edit 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 to ModelForm after removing base_object, the credited object.

Attributes: roles: The roles held. affiliation: The contributor’s affiliation for this credit.

Initialization

roles#

‘ModelMultipleChoiceField(…)’

affiliation#

‘ModelChoiceField(…)’

class Meta#
model#

None

fields#

[‘roles’, ‘affiliation’]

labels#

None

help_texts#

None