Scholarship Records

The geniza.footnotes application provides models for Source records and Footnotes to connect sources to Document objects.

models

class geniza.footnotes.models.Authorship(*args, **kwargs)[source]

Ordered relationship between Creator and Source.

exception DoesNotExist
exception MultipleObjectsReturned
class geniza.footnotes.models.Creator(*args, **kwargs)[source]

author or other contributor to a source

exception DoesNotExist
exception MultipleObjectsReturned
clean_fields(exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

firstname_lastname()[source]

Creator full name, with first name first

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

natural_key()[source]

natural key: tuple of last name, first name

refresh_from_db(using=None, fields=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

class geniza.footnotes.models.CreatorManager(*args, **kwargs)[source]

Custom manager for Creator with natural key lookup

get_by_natural_key(last_name, first_name)[source]

natural key lookup: based on combination of last name and first name

class geniza.footnotes.models.Footnote(*args, **kwargs)[source]

a footnote that links a Document to a Source

exception DoesNotExist
exception MultipleObjectsReturned
property content_html

content as html, if available; returns a dictionary of lists. keys are canvas ids, list is html content.

property content_html_str

content as a single string of html, if available

property content_text

content as plain text, if available

property content_text_canvases

content as a list of strings, one per canvas

display()[source]

format footnote for display; used on document detail page and metadata export for old pgp site

static explicit_line_numbers(html)[source]

add explicit line numbers to passed HTML (in value attributes of ol > li)

has_url()[source]

Admin display field indicating if footnote has a url.

iiif_annotation_content()[source]

Return transcription content from this footnote (if any) as a IIIF annotation resource that can be associated with a canvas.

class geniza.footnotes.models.FootnoteQuerySet(model=None, query=None, using=None, hints=None)[source]
editions()[source]

Filter to all footnotes that provide editions/transcriptions.

includes_footnote(other)[source]

Check if the current queryset includes a match for the specified footnote. Matches are made by comparing content source, location, document relation type, and notes. Returns the matching object if there was one, or False if not.

metadata_prefetch()[source]

prefetch source, source authors, and content object

class geniza.footnotes.models.Source(*args, **kwargs)[source]

a published or unpublished work related to geniza materials

exception DoesNotExist
exception MultipleObjectsReturned
all_authors()[source]

semi-colon delimited list of authors in order

all_languages()[source]

comma-delimited list of languages, in parentheses, used for the translation selector

clean_fields(exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

display()[source]

strip HTML tags from formatted display

formatted_display(extra_fields=True)[source]

Format source for display; used on document scholarship page. To omit publisher, place_published, and page_range fields, specify extra_fields=False.

classmethod from_uri(uri)[source]

Given a URI for a Source (as used in transcription annotations), return the Source object matching the pk

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

classmethod get_volume_from_shelfmark(shelfmark)[source]

Given a shelfmark, get our volume label. This logic was determined in migration 0011_split_goitein_typedtexts.py

static id_from_uri(uri)[source]

Given a URi for a source (as used in transcription annotations), return the source id

refresh_from_db(using=None, fields=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

property uri

Generate a URI for this source to be used in transcription annotations, in order to filter them by associated source

class geniza.footnotes.models.SourceLanguage(*args, **kwargs)[source]

language of a source document

exception DoesNotExist
exception MultipleObjectsReturned
class geniza.footnotes.models.SourceQuerySet(*args, **kwargs)[source]

Custom queryset for Source, for reusable prefetching and count annotation.

footnote_count()[source]

annotate with footnote count

metadata_prefetch()[source]

prefetch source type and authors

class geniza.footnotes.models.SourceType(*args, **kwargs)[source]

type of source

exception DoesNotExist
exception MultipleObjectsReturned