fairdm.core.dataset.forms#

Forms for creating and editing datasets.

Module Contents#

Classes#

DatasetForm

Form for creating and editing a dataset.

DatasetCreateForm

Form for creating a dataset, asking only for name, project, licence and visibility.

API#

class DatasetForm(request=None, *args, **kwargs)#

Bases: fairdm.core.forms.ManagerOnlyFieldsMixin, fairdm.forms.ModelForm

Form for creating and editing a dataset.

With a request, the project field offers only the authenticated user’s own projects, and an anonymous user sees none. Without one, every project is offered. The licence defaults to CC BY 4.0, or the FAIRDM_DEFAULT_LICENSE setting. External identifiers are edited as rows on the update page, not through a field here.

Args: request: The current request, used to limit the project choices. *args: Positional arguments passed to ModelForm. **kwargs: Keyword arguments passed to ModelForm, such as instance.

Attributes: image: Optional cover image. name: The dataset’s name. project: The project the dataset belongs to. license: The licence the dataset’s data is published under. reference: The literature item that is the dataset’s data publication. visibility: Whether the dataset’s metadata may be read by anyone using the portal.

Initialization

image#

‘ImageField(…)’

name#

‘CharField(…)’

project#

‘ModelChoiceField(…)’

license#

‘ModelChoiceField(…)’

reference#

‘PublicationChoiceField(…)’

visibility#

‘TypedChoiceField(…)’

class Meta#
model#

None

fields#

[‘image’, ‘name’, ‘project’, ‘license’, ‘reference’, ‘visibility’]

helper_attrs#

None

manager_only_fields#

(‘visibility’, ‘project’)

class DatasetCreateForm(request=None, *args, **kwargs)#

Bases: fairdm.core.dataset.forms.DatasetForm

Form for creating a dataset, asking only for name, project, licence and visibility.

The other fields are available after creation on the update page.

Args: request: The current request, used to limit the project choices. *args: Positional arguments passed to DatasetForm. **kwargs: Keyword arguments passed to DatasetForm.

Initialization

class Meta#

Bases: fairdm.core.dataset.forms.DatasetForm

fields#

[‘name’, ‘project’, ‘license’, ‘visibility’]