fairdm.core.dataset.forms#
Forms for creating and editing datasets.
Module Contents#
Classes#
Form for creating and editing a dataset. |
|
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.ModelFormForm 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_LICENSEsetting. 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 toModelForm, such asinstance.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.DatasetFormForm 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 toDatasetForm.Initialization
- class Meta#
Bases:
fairdm.core.dataset.forms.DatasetForm- fields#
[‘name’, ‘project’, ‘license’, ‘visibility’]