fairdm.contrib.contributors.forms.forms#

Inline formsets and forms for identifiers and affiliations.

Module Contents#

Classes#

UserIdentifierFormSet

Identifier formset that tells each form which types the other identifiers already use.

UserIdentifierForm

Edit a persistent identifier, offering only types that suit the contributor and are not already used.

AffiliationForm

Edit a person’s affiliation, setting the type of a new one from the organisation’s managers.

API#

class UserIdentifierFormSet(data=None, files=None, instance=None, save_as_new=False, prefix=None, queryset=None, **kwargs)#

Bases: django.forms.models.BaseInlineFormSet

Identifier formset that tells each form which types the other identifiers already use.

Initialization

get_form_kwargs(index)#

Pass the types used by the other identifiers to each form.

class UserIdentifierForm(*args, **kwargs)#

Bases: django.forms.ModelForm

Edit a persistent identifier, offering only types that suit the contributor and are not already used.

Args: *args: Passed to ModelForm. **kwargs: Passed to ModelForm after removing contributor_instance, the contributor being edited, and existing_types, the types already in use.

Initialization

class Meta#
model#

None

fields#

[‘type’, ‘value’]

field_classes#

None

labels#

None

class AffiliationForm(*args, **kwargs)#

Bases: django.forms.ModelForm

Edit a person’s affiliation, setting the type of a new one from the organisation’s managers.

A new affiliation is pending when the organisation has an owner or admin, and a member otherwise.

Attributes: organization: The organisation joined.

Initialization

organization#

‘OrganizationChoiceField(…)’

save(commit=True)#

Set the type of a new affiliation, then save.

class Meta#
model#

None

fields#

[‘organization’, ‘is_primary’]

labels#

None

help_texts#

None