fairdm.core.dataset.admin#
Django admin configuration for the Dataset models.
Registers DatasetAdmin with search, filters, bounded inlines for descriptions, dates and
identifiers, and a warning when the licence of a dataset carrying a DOI changes. It declares no
bulk action of its own, so visibility can only be changed one dataset at a time.
Module Contents#
Classes#
Minimal admin for literature items, required by the autocomplete on |
|
Inline admin for dataset descriptions, limited to one row per description type. |
|
Inline admin for dataset dates, limited to one row per date type. |
|
Inline admin for dataset identifiers, limited to one row per identifier type. |
|
Admin for datasets. |
Data#
API#
- class ItemAdmin(model, admin_site)#
Bases:
django.contrib.admin.ModelAdminMinimal admin for literature items, required by the autocomplete on
DatasetAdmin.reference.Initialization
- search_fields#
(‘title’, ‘citation_key’)
- list_display#
(‘title’,)
- class DescriptionInline(parent_model, admin_site)#
Bases:
django.contrib.admin.StackedInlineInline admin for dataset descriptions, limited to one row per description type.
Initialization
- model#
None
- fk_name#
‘related’
- extra#
0
- get_formset(request, obj=None, **kwargs)#
Cap the formset at the number of description types.
- DateInlineFormSet#
‘date_ordering_formset(…)’
- class DateInline(parent_model, admin_site)#
Bases:
django.contrib.admin.StackedInlineInline admin for dataset dates, limited to one row per date type.
DateInlineFormSetalso refuses a collection end date before the collection start date.Initialization
- model#
None
- fk_name#
‘related’
- formset#
None
- extra#
0
- get_formset(request, obj=None, **kwargs)#
Cap the formset at the number of date types.
- class IdentifierInline(parent_model, admin_site)#
Bases:
django.contrib.admin.TabularInlineInline admin for dataset identifiers, limited to one row per identifier type.
Initialization
- model#
None
- fk_name#
‘related’
- extra#
0
- get_formset(request, obj=None, **kwargs)#
Cap the formset at the number of identifier types.
- class DatasetAdmin(model, admin_site)#
Bases:
django.contrib.admin.ModelAdminAdmin for datasets.
Bulk visibility changes are deliberately absent, so a private dataset cannot be exposed by accident. Changing the licence of a dataset that has a DOI shows a warning, because the published DOI metadata may still name the original licence.
Initialization
- inlines#
None
- search_fields#
(‘name’, ‘uuid’, ‘identifiers__value’, ‘project__name’)
- list_display#
(‘name’, ‘added’, ‘modified’, ‘has_data’, ‘has_abstract’, ‘has_doi’, ‘published’)
- list_filter#
(‘project’, ‘license’, ‘visibility’, ‘published’)
- readonly_fields#
(‘uuid’, ‘added’, ‘modified’)
- autocomplete_fields#
(‘project’, ‘reference’)
- fieldsets#
((), (), (), (), ())
- get_queryset(request)#
Include private datasets and annotate the abstract and DOI flags.
- has_abstract(obj)#
Return whether the dataset carries an abstract description.
- has_doi(obj)#
Return whether the dataset carries a DOI identifier.
- save_model(request, obj, form, change)#
Save the dataset, warning when the licence of a dataset with a DOI changes.