literature.models#

Django models: a relational form of the CSL JSON 1.0.2 bibliographic data format.

class Item(*args, **kwargs)[source]#

Bases: Model

CSL JSON top-level item object.

Stores all scalar/string/number CSL JSON fields as columns. Name-variables, date-variables, and identifiers are stored in related models (ItemName, ItemDate, ItemIdentifier).

Maps to the top-level item object of the CSL JSON schema (https://resource.citationstyles.org/schema/v1.0/input/json/csl-data.json).

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

abstract#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

annote#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

archive#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

archive_collection#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

archive_location#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

archive_place#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

authority#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property authors: list[Name]#

Return the item’s authors, in their stored order.

call_number#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

categories#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

chapter_number#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

citation_key#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

citation_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

collection_number#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

collection_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

container_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

container_title_short#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

custom#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

dimensions#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

division#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property doi: str | None#

Return the DOI among the item’s identifiers, or None if it has none.

Reads item_identifiers.all(), so a queryset that prefetches item_identifiers answers it without a query per item.

Returns:

The DOI value, or None.

property doi_url: str | None#

Return the https://doi.org/ link for the item’s DOI, or None.

edition#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property editors: list[Name]#

Return the item’s editors, in their stored order.

event_place#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

event_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

genre#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_absolute_url() → str[source]#

Return the reference’s page in the opt-in front end, or raise NoReverseMatch without it.

get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<django.db.models.fields.DateTimeField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<django.db.models.fields.DateTimeField: modified>, is_next=False, **kwargs)#
get_type_display(*, field=<django.db.models.fields.CharField: type>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

issue#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

item_dates#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

item_identifiers#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

item_names#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

journal_abbreviation#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

jurisdiction#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

keyword#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

language#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

medium#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

names_in_role(role: str) → list[Name][source]#

Return the names credited in role, in their stored order.

Reads item_names.all(), so a queryset that prefetches item_names__name answers it without a query per item.

Parameters:

role – A NameRole value.

Returns:

The names, in order.

note#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_pages#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

number_of_volumes#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
original_publisher#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

original_publisher_place#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

original_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

page#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

page_first#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

part#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

part_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

printing#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

publisher#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

publisher_place#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

readinglistentry_set#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

references#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reviewed_genre#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

reviewed_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

scale#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

section#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

source#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

supplement#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

title_short#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

type#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

version#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

volume#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

volume_title#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

volume_title_short#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

property year: int | None#

Return the year of the issued date, or None when no year is stored.

An issued date held only as text, such as “in press”, has no year. Reads item_dates.all(), so a queryset that prefetches item_dates answers it without a query per item.

Returns:

The year, or None.

class ItemDate(*args, **kwargs)[source]#

Bases: Model

CSL JSON date-variable instance for a specific date slot on an item.

Stores partial dates using django-partial-dates’ PartialDateField, supporting year-only, year-month, and full-date precision. Date ranges are represented by setting both begin and end.

Maps to a CSL JSON date-variable object keyed by slot name, such as issued, accessed or event-date.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

begin#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

circa#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

clean() → None[source]#

Require a begin for any end, and an end no earlier than it (FS-012).

date_type#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

end#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_date_type_display(*, field=<django.db.models.fields.CharField: date_type>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

item#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

item_id#
literal#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
raw#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

raw_date_parts#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)[source]#

Validate the span rule before writing, so a direct save() cannot skip it.

season#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class ItemIdentifier(*args, **kwargs)[source]#

Bases: Model

Typed identifier record for a bibliographic item.

Stores DOI, ISBN, ISSN, PMID, PMCID, URL and any other identifier type as a (type, value) pair linked to an Item.

The type field intentionally does NOT use choices= validation — this allows unknown identifier type strings to be stored without rejection. The IdentifierType enum provides known values for lookup and documentation only.

The (item, type) uniqueness constraint means each item stores at most one identifier per type, so two ISBNs (ISBN-10 and ISBN-13) are not supported.

Maps to the DOI, ISBN, ISSN, PMID, PMCID and URL top-level CSL JSON fields; unknown types are placed in the custom object on export.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

clean() → None[source]#

Validate the identifier’s value format for known identifier types.

id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

item#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

item_id#
objects = <django.db.models.manager.Manager object>#
save(*args, **kwargs)[source]#

Validate the identifier format before writing, so a direct save() cannot skip it.

type#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

value#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class ItemName(*args, **kwargs)[source]#

Bases: Model

Ordered through-model linking Name to Item with a contributor role.

Provides explicit position ordering of contributors within each (item, role) scope via the order field: the author list, the editor list, and so on are each numbered independently from zero, so reordering one role never disturbs another. The position is assigned in save() on first insert. See ADR-0005.

Maps to the name-variable array entries of a CSL JSON item, such as its author and editor arrays.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

get_role_display(*, field=<django.db.models.fields.CharField: role>)#
id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

item#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

item_id#
name#

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

name_id#
objects = <django.db.models.manager.Manager object>#
order#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

role#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)[source]#

Append a new row to the end of its (item, role) sequence.

class Name(*args, **kwargs)[source]#

Bases: Model

CSL JSON name-variable definition.

Stores all constituent parts of a personal or institutional name as defined in the CSL JSON 1.0.2 name-variable schema. Names are shared across items; the ItemName through-model records the role and ordered position. Maps to the CSL JSON name-variable object.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

comma_suffix#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

dropping_particle#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

family#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)#
get_next_by_modified(*, field=<django.db.models.fields.DateTimeField: modified>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)#
get_previous_by_modified(*, field=<django.db.models.fields.DateTimeField: modified>, is_next=False, **kwargs)#
given#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

item_names#

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

literal#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

modified#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

non_dropping_particle#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>#
parse_names#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

static_ordering#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

suffix#

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.