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#

ItemAdmin

Minimal admin for literature items, required by the autocomplete on DatasetAdmin.reference.

DescriptionInline

Inline admin for dataset descriptions, limited to one row per description type.

DateInline

Inline admin for dataset dates, limited to one row per date type.

IdentifierInline

Inline admin for dataset identifiers, limited to one row per identifier type.

DatasetAdmin

Admin for datasets.

Data#

API#

class ItemAdmin(model, admin_site)#

Bases: django.contrib.admin.ModelAdmin

Minimal 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.StackedInline

Inline 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.StackedInline

Inline admin for dataset dates, limited to one row per date type.

DateInlineFormSet also 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.TabularInline

Inline 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.ModelAdmin

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