Code Documentation

Common

Django app for shared code and functionality used across other applications within the project. Currently includes abstract database models with common functionality or fields that are used by models in multiple apps within the project.

Models

class mep.common.models.AliasIntegerField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Alias field adapted from https://djangosnippets.org/snippets/10440/ to allow accessing an existing db field by a different name, both for user display and in model and queryset use.

contribute_to_class(cls, name, private_only=False)[source]

Register the field with the model class it belongs to.

If private_only is True, create a separate instance of this field for every subclass of cls, even if cls is not an abstract model.

class mep.common.models.DateRange(*args, **kwargs)[source]

Abstract model with optional start and end years, and a custom dates property to display the date range nicely. Includes validation that requires end year falls after start year.

clean()[source]

validate that end year is greater than or equal to start year

property dates

Date or date range as a string for display

end_year

end year (optional)

start_year

start year (optional)

class mep.common.models.Named(*args, **kwargs)[source]

Abstract model with a ‘name’ field; by default, name is used as the string display.

name

unique name (required)

class mep.common.models.Notable(*args, **kwargs)[source]

Abstract model with an optional notes text field

has_notes()[source]

boolean flag indicating if notes are present, for display in admin lists

note_snippet()[source]

First 75 letters of the note, for brief display

notes

optional notes

class mep.common.models.TrackChangesModel(*args, **kwargs)[source]

Model mixin that keeps a copy of initial data in order to check if fields have been changed. Change detection only works on the current instance of an object.

has_changed(field)[source]

check if a field has been changed

initial_value(field)[source]

return the initial value for a field

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

Saves data and reset copy of initial data.

Utils

mep.common.utils.abbreviate_labels(labels)[source]

Abbreviate labels so they are as short as possible but distinct from preceding and following labels. Optionally used with alpha_pagelabels()

mep.common.utils.absolutize_url(local_url, request=None)[source]

Convert a local url to an absolute url, with scheme and server name, based on the current configured Site.

Parameters

local_url – local url to be absolutized, e.g. something generated by reverse()

mep.common.utils.alpha_pagelabels(paginator, objects, attr_meth, max_chars=None)[source]

Generate abbreviated, alphabetical page labels for pagination items. Label format should be something like ‘Ab - Ad’, ‘Ard - Art’.

Parameters
  • paginator – a django paginator

  • objects – the complete list of objects paginated by the paginator

  • attr_meth – method or lambda to retrieve the attribute on the object that should be used for page labels

Returns

OrderedDict where keys are page numbers and values are page labels

mep.common.utils.login_temporarily_required(func)[source]

Test decorator for views that have LoginRequiredOr404 enabled. Creates a user with no permissions on first run for a given class, and logs in as that user before running the decorated test method. Intended for use on Django TestCase class methods.

Views

class mep.common.views.AjaxTemplateMixin(**kwargs)[source]

View mixin to use a different template when responding to an ajax request.

ajax_template_name = None

name of the template to use for ajax request

dispatch(request, *args, **kwargs)[source]

Set a total result header on the response

get_template_names()[source]

Return ajax_template_name if this is an ajax request; otherwise return default template name.

vary_headers = ['X-Requested-With']

vary on X-Request-With to avoid browsers caching and displaying ajax response for the non-ajax response

class mep.common.views.FacetJSONMixin(**kwargs)[source]

View mixin to respond with JSON representation of Solr facets when the HTTP Accept: header specifies application/json.

render_facets(request, *args, **kwargs)[source]

Construct a JsonResponse based on the already-populated queryset data for the view.

render_to_response(request, *args, **kwargs)[source]

Return a JsonResponse if the client asked for JSON, otherwise just call dispatch(). NOTE that this isn’t currently smart enough to detect if the view’s queryset is a SolrQuerySet; it will just break.

vary_headers = ['Accept']

vary on Accept: so that facets and results are cached separately

class mep.common.views.LabeledPagesMixin[source]

View mixin to add labels for pages to a paginated view’s context, for use in rendering pagination controls.

dispatch(request, *args, **kwargs)[source]

Wrap the dispatch method to patch in page label header for ajax requests.

get_context_data(**kwargs)[source]

Add generated page labels to the view context.

get_page_labels(paginator)[source]

Generate labels for pages. Defaults to labeling pages using numeric ranges, e.g. 50-100.

class mep.common.views.LoginRequiredOr404Mixin[source]

Extend LoginRequiredMixin to return a 404 if access is denied, rather than redirecting to the login form.

handle_no_permission()[source]

If permission is denied, raise an Http404

class mep.common.views.RdfViewMixin[source]

View mixin to add an RDF linked data graph to context for use in serializing and embedding structured data in templates.

add_rdf_to_context(context)[source]

add jsonld and breadcrumb list to context dictionary

as_rdf()[source]

Generate an RDF graph representing the page.

breadcrumbs = []

breadcrumbs, used to render breadcrumb navigation. they should be a list of tuples like (‘Title’, ‘/url’)

get_absolute_url()[source]

Get a URI for this page to use for making RDF assertions. Note that this should return a full absolute path, e.g. with absolutize_url().

get_breadcrumbs()[source]

Generate the breadcrumbs that lead to this page. Returns the value of breadcrumbs set on the View by default.

get_context(request, *args, **kwargs)[source]

Add generated breadcrumbs and RDF graph to Wagtail page context.

get_context_data(*args, **kwargs)[source]

Add generated breadcrumbs and an RDF graph to the view context.

rdf_type = rdflib.term.URIRef('http://schema.org/WebPage')

default schema.org type for a View

class mep.common.views.SolrLastModifiedMixin(**kwargs)[source]

View mixin to add last modified headers based on Solr

dispatch(request, *args, **kwargs)[source]

Wrap the dispatch method to add a last modified header if one is available, then return a conditional response.

get_solr_lastmodified_filters()[source]

Get filters for last modified Solr query. By default returns solr_lastmodified_filters.

last_modified()[source]

Return last modified datetime.datetime from the specified Solr query

solr_lastmodified_filters = {}

solr query filter for getting last modified date

class mep.common.views.VaryOnHeadersMixin(**kwargs)[source]

View mixin to set Vary header - class-based view equivalent to django.views.decorators.vary.vary_on_headers(), adapted from winthrop-django.

Define vary_headers with the list of headers.

dispatch(request, *args, **kwargs)[source]

Wrap default dispatch method to patch haeders on the response.

Validators

mep.common.validators.verify_latlon(value)[source]

Convenience validator to check that a latitude or longitude value is a valid deciaml degree between -180 and 180.

Accounts

Django app to manage information about accounts for people who were members of the Sylvia Beach lending library.

Models

class mep.accounts.models.Account(*args, **kwargs)[source]

Central model for all account and related information, M2M explicity to people.Person

exception DoesNotExist
exception MultipleObjectsReturned
add_event(etype='event', **kwargs)[source]
Helper function to add a Event or subclass to an

instance of Account. Requires that the Account object be saved first (so it has a set primary key). This provides functionality normally in the self.*_set functionality of Django, but not provided with subclassed table inheritence.

Parameters

etypestr One of borrow, event, subscription, purchase, reimbursement

get_events(etype='event', **kwargs)[source]

Helper function to retrieve related events of any valid type for Account.add_event(). This provides functionality normally in the self.*_set functionality, but not provided with subclassed table inheritence.

Parameters

etypestr One of borrow, event, subscription, purchase, reimbursement

Keyword Arguments

Any valid query kwargs for Account, defaults to equivalent of Foo.objects.all().

has_card()[source]

Account has an associated lending card

list_locations()[source]

List of associated mep.people.models.Location

list_persons()[source]

List mep.people.models.Person instances associated with this account.

member_card_images()[source]

Return a queryset for card images that are part of this account’s associated card manifest OR that have events for this account. Note that this returns a union queryset, which puts some retrictions on supported operations.

property reimbursement_set

associated reimbursement events, as queryset of Reimbursement

property subscription_set

associated subscription events, as queryset of Subscription

class mep.accounts.models.Address(*args, **kwargs)[source]

Address associated with an Account or a Person. Used to associate locations with people and accounts, with optional start and end dates and a care/of person.

exception DoesNotExist
exception MultipleObjectsReturned
clean()[source]

Validate to require one and only one of Account or Person

class mep.accounts.models.Borrow(*args, **kwargs)[source]

Inherited table indicating borrow events

exception DoesNotExist
ITEM_RETURNED = 'R'

Work that was borrowed; optional to account for unclear titles

exception MultipleObjectsReturned
save(*args, **kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class mep.accounts.models.CurrencyMixin(*args, **kwargs)[source]

Mixin for currency field with currency symbol display

currency_symbol()[source]

symbol for the selected currency

class mep.accounts.models.Event(*args, **kwargs)[source]

Base table for events in the Shakespeare and Co. Lending Library

exception DoesNotExist
exception MultipleObjectsReturned
event_label

Event type label that includes nonstandard events indicated by notation in private notes as well as all the standard types.

nonstandard_notation = {'NOTATION: BOUGHTFOR': 'Purchase', 'NOTATION: LOAN': 'Loan', 'NOTATION: PERIODICALSUBSCRIPTION': 'Periodical Subscription', 'NOTATION: REQUEST': 'Request', 'NOTATION: SBGIFT': 'Gift', 'NOTATION: SOLDFOR': 'Purchase', 'STRIKETHRU': 'Crossed out'}

notation in private notes indicating kind of nonstandard events

class mep.accounts.models.EventQuerySet(model=None, query=None, using=None, hints=None)[source]

Custom Queryset for Event with filter methods for generic events and each event subtype.

book_activities()[source]

All events tied to a Work.

borrows()[source]

Events with associated borrow event only

generic()[source]

Generic events only (excludes subscriptions, reimbursements, borrows, and purchases).

known_years()[source]

Filter out any events with unknown years for start or end date.

membership_activities()[source]

Subscription and reimbursement events

purchases()[source]

Events with associated purchase event only

reimbursements()[source]

Events with associated reimbursement event only

subscriptions()[source]

Events with associated subscription event only

class mep.accounts.models.Purchase(*args, **kwargs)[source]

Inherited table indicating purchase events; extends Event

exception DoesNotExist
exception MultipleObjectsReturned
date()[source]

alias of date_range for display; since reimbersument is a single-day event will always be a single partial date.

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

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

class mep.accounts.models.Reimbursement(*args, **kwargs)[source]

Reimbursement event; extends Event

exception DoesNotExist
exception MultipleObjectsReturned
date()[source]

alias of start_date for display, since reimbersument is a single-day event

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

Reimbursement is a single-day event; populate end date on save to make that explicit and simplify any generic event date range searching and filtering.

validate_unique(*args, **kwargs)[source]

Validation check to prevent duplicate events from being added to the system. Does not allow more than one reimbursement for the account and date. Used instead of unique_together because of multi-table inheritance.

class mep.accounts.models.Subscription(*args, **kwargs)[source]

Records subscription events in the MEP database

exception DoesNotExist
exception MultipleObjectsReturned
calculate_duration()[source]

calculate and set subscription duration based on start and end date, when both are known

purchase_date

date the purchase was bought; not necessarily the day it started!

readable_duration()[source]

Generate a human-readable version of the subscription duration. Intended to follow Beach’s conventions, e.g. 1 year rather than 12 months; 1 week rather than 7 days.

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

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

total_amount()[source]

total amount paid (price paid + deposit if any)

validate_unique(*args, **kwargs)[source]

Validation check to prevent duplicate events from being added to the system. Does not allow more than one subscription for the same account and date.

class mep.accounts.models.SubscriptionType(*args, **kwargs)[source]

Type of subscription

exception DoesNotExist
exception MultipleObjectsReturned

Partial Dates

class mep.accounts.partial_date.DatePrecision[source]

Flag class to indicate which parts of a date are known.

class mep.accounts.partial_date.DatePrecisionField(verbose_name=None, name=None, primary_key=False, max_length=None, unique=False, blank=False, null=False, db_index=False, rel=None, default=<class 'django.db.models.fields.NOT_PROVIDED'>, editable=True, serialize=True, unique_for_date=None, unique_for_month=None, unique_for_year=None, choices=None, help_text='', db_column=None, db_tablespace=None, auto_created=False, validators=(), error_messages=None)[source]

Integer representation of a DatePrecision.

from_db_value(value, expression, connection)[source]

Convert values returned from database to DatePrecision using to_python()

to_python(value)[source]

Convert integer to :class`DatePrecision` if set

value_to_string(obj)[source]

Customize string value for JSON serialization

class mep.accounts.partial_date.KnownYear(lhs, rhs)[source]

Custom lookup to filter on known year in :class:`DatePrecisionField

class mep.accounts.partial_date.PartialDate(date_field, date_precision_field, unknown_year=1, label=None)[source]

Descriptor that gets and sets a related datetime.date and DatePrecision from partial date strings, e.g. –05-02.

static date_format(value)[source]

Return a format string for use with datetime.date.strftime() to output a date with the appropriate precision

parse_date(value)[source]

Parse a partial date string and return a datetime.date and precision value.

class mep.accounts.partial_date.PartialDateFormMixin(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Provides form validation and setting for models that inherit from mep.accounts.models.PartialDateMixin.

clean()[source]

Parse partial dates and save them on form submission.

get_initial_for_field(field, name)[source]

Return initial data for field on form. Use initial data from the form or the field, in that order. Evaluate callable values.

class mep.accounts.partial_date.PartialDateMixin(*args, **kwargs)[source]

Mixin to add fields for partial start and end dates to a model using DatePrecisionField and PartialDate.

calculate_date(kind, dateval=None, earliest=None, latest=None)[source]

Calculate end or start date based on a single value in a supported partial date form or based on earliest/latest datetime.

property date_range

Borrowing event date range as string, using partial dates. Returns a single date in partial date format if both dates are set to the same date. Uses “??” for unset dates, and returns in format start/end.

views

class mep.accounts.views.AccountAutocomplete(**kwargs)[source]

Basic autocomplete lookup, for use with django-autocomplete-light and mep.accounts.models.Account in address many-to-many

get_queryset()[source]

Get a queryset filtered by query string. Searches on account id, people associated with account, and addresses associated with account

class mep.accounts.views.Twitter100yearsReview(**kwargs)[source]

Admin view to review upcoming 100 years tweets before they are posted on twitter. Finds and displays tweets for events in the next three months, using the same logic for generating tweet content that the twitter bot manage command uses.

get_context_data()[source]

Get the context for this view.

get_date_range()[source]

Determine start and end date for events to review. Start 100 years before today, end 4 weeks after that.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of mep.accounts.models.Event

Manage Commands

report timegaps

Manage command to identify and report on large gaps in time between events in a single library account, to identify possible candidates for demerging. Options allow specifying the minimum gap to look for in months (default is 6 months) and a required filename to use for CSV output. By default, borrowing events are not included. If specified, borrowing events will be included but borrow events with partially know dates will be skipped.

Example usage:

python manage.py report_timegaps -o 6month-gaps.csv
python manage.py report_timegaps -g 12 months -o 12month-gaps.csv
python manage.py report_timegaps -g 12 months --borrows -o 12month-gaps-with-borrows.csv
class mep.accounts.management.commands.report_timegaps.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Look for accounts with large time gaps between events to identify possible candidates for demerge

add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

csv_header = ['Admin URL(s)', 'Account', 'Account Date Range', '# Gaps', 'Longest Gap in days', 'Details']

columns for CSV output

find_gaps(account, gapsize)[source]

Identify and return gaps between account events that are larger than the specified gap size. Returns a list of tuples of start and event dates for any gaps found. Currently ignores borrow events with partially known dates.

Parameters
format_relativedelta(rel_delta)[source]

Generate a human-readable display for a relativedelta in years, months, and days

handle(*args, **kwargs)[source]

The actual logic of the command. Subclasses must implement this method.

include_borrows = False

include borrowing events when checking for gaps between events?

report_gap_details(gaps)[source]

Given a list of gaps as generated by find_gaps(), return the maximum gap size in days and a message reporting the specifics of the event types and dates with gaps.

v_normal = 1

default verbosity

export events

Manage command to export event data for use by others.

Generates a CSV and JSON file including details on every event in the database with summary details and URIs for associated library member(s) and book (for events linked to books).

class mep.accounts.management.commands.export_events.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]

Export event data.

get_object_data(obj)[source]

Generate a dictionary of data to export for a single Event

get_queryset()[source]

get event objects to be exported

item_info(event)[source]

associated work details for an event

member_info(event)[source]

Event about member(s) for the account associated with an event.

model

alias of mep.accounts.models.Event

source_info(footnote)[source]

source details from a footnote

subscription_info(event)[source]

subscription details for an event

twitterbot 100years

class mep.accounts.management.commands.twitterbot_100years.Command(stdout=None, stderr=None, no_color=False, force_color=False)[source]
add_arguments(parser)[source]

Entry point for subclassed commands to add custom arguments.

find_events(date)[source]

Find events 100 years before the current day or a specified day in YYYY-MM-DD format.

get_date(date=None, mode=None, **kwargs)[source]

Find events relative to the specified day, if set, or the date 100 years ago. Overriding the date is only allowed in report mode.

get_tweepy()[source]

Initialize tweepy API client based on django settings.

handle(*args, **kwargs)[source]

The actual logic of the command. Subclasses must implement this method.

report(date)[source]

Print out the content that would be tweeted on the specified day

schedule(date)[source]

Schedule all tweetable events for the specified date.

tweet(event, date)[source]

Tweet the content for the event on the specified date.

tweet_at(event, time)[source]

schedule a tweet for later today

mep.accounts.management.commands.twitterbot_100years.can_tweet(ev, day)[source]

Check if the event can be tweeted on the specified day

mep.accounts.management.commands.twitterbot_100years.card_url(member, ev)[source]

Return the member card detail url for the event based on footnote image, if present.

mep.accounts.management.commands.twitterbot_100years.tweet_content(ev, day)[source]

Generate tweet content for the specified event on the specified day.

mep.accounts.management.commands.twitterbot_100years.work_label(work)[source]

Convert a Work for display in tweet content. Standard formats: - author’s “title” (year) - periodical: an issue of “title”

Handles multiple authors (and for two, et al. for more), includes editors if there are no authors. Only include years after 1500.

Books

Django app to manage information about titles associated with the Sylvia Beach lending library.

Models

class mep.books.models.Creator(id, notes, creator_type, person, work, order)[source]
exception DoesNotExist
exception MultipleObjectsReturned
class mep.books.models.CreatorType(*args, **kwargs)[source]

Type of creator role a person can have in relation to a work; author, editor, translator, etc.

exception DoesNotExist
exception MultipleObjectsReturned
class mep.books.models.Edition(*args, **kwargs)[source]

A specific known edition of a Work that circulated.

exception DoesNotExist
exception MultipleObjectsReturned
display_html()[source]

Render volume/issue citation with formatting, suitable for inclusion on a webpage.

display_text()[source]

text-only version of volume/issue citation

updated_at

update timestamp

class mep.books.models.EditionCreator(*args, **kwargs)[source]

Creator specific to an Edition of a Work.

exception DoesNotExist
exception MultipleObjectsReturned
class mep.books.models.Format(*args, **kwargs)[source]

Format of items in the library (book, periodical, etc)

exception DoesNotExist
exception MultipleObjectsReturned
uri

linked data URI for the format

class mep.books.models.Genre(*args, **kwargs)[source]

Genres of items from OCLC

exception DoesNotExist
exception MultipleObjectsReturned
class mep.books.models.PastWorkSlug(*args, **kwargs)[source]

A slug that was previously associated with a Work; preserved so that former slugs will resolve to the correct work.

exception DoesNotExist
exception MultipleObjectsReturned
slug

slug

work

work record this slug belonged to

class mep.books.models.Publisher(*args, **kwargs)[source]

Model for publishers

exception DoesNotExist
exception MultipleObjectsReturned
class mep.books.models.PublisherPlace(*args, **kwargs)[source]

Model for place where publishers are located

exception DoesNotExist
exception MultipleObjectsReturned
class mep.books.models.Subject(*args, **kwargs)[source]

Linked data subjects for describing Item

exception DoesNotExist
exception MultipleObjectsReturned
classmethod create_from_uri(uri)[source]

Initialize a new Subject from a URI. Loads the URI as an rdflib.Graph in order to pull the preferred label and RDF type for the URI.

name

name/label for the subject (required but not required unique)

rdf_type

rdf type for the subject

uri

linked data URI for the subject

class mep.books.models.Work(*args, **kwargs)[source]

Work record for an item that circulated in the library or was other referenced in library activities.

exception DoesNotExist
exception MultipleObjectsReturned
UNCERTAINTY_MESSAGE = 'Work data is uncertain or incomplete.'

Message that will be read to users of assistive technology in place of the uncertainty icon.

admin_url()[source]

URL to edit this record in the admin site

author_list()[source]

semicolon separated list of author names

property authors

work creators with type author

property borrow_count

Number of times this work was borrowed.

creator_by_type(creator_type)[source]

return work creators of a single type, e.g. author

property creator_names

list of all creator names, including authors

property editors

work creators with type editor

property event_count

Number of events of any kind associated with this work.

property first_known_interaction

date of the earliest known interaction for this item

format()[source]

format of this work if known (e.g. book or periodical)

generate_slug()[source]

Generate a slug for this work based on author and title and ensure it is unique.

genre_list()[source]

semicolon separated list of genres

genres

optional genres, from OCLC record

get_absolute_url()[source]

Return the public url to view book’s detail page

has_uri()[source]

Is the URI is set for this work?

index_data()[source]

data for indexing in Solr

property is_uncertain

Returns True if the Work’s notes indicate that it should show an uncertainty icon via the UNCERTAINTYICON tag.

classmethod items_to_index()[source]

Modify the queryset used for indexing in bulk; prefetch creators, annotate event counts.

mep_id

mep id from stub records imported from xml

populate_from_worldcat(worldcat_entity)[source]

Set work URI, edition URI, genre, item type, and subjects based on a WorldCat record.

public_notes

a field for notes publicly displayed on the website

property purchase_count

Number of times this work was purchased.

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

Saves data and reset copy of initial data.

slug

slug for use in urls

property sort_author_list

semicolon separated list of author sort names

subject_list()[source]

semicolon separated list of subject names

subjects

optional subjects, from OCLC record

property translators

work creators with type translator

updated_at

update timestamp

validate_unique(exclude=None)[source]

Check unique constraints on the model and raise ValidationError if any failed.

class mep.books.models.WorkQuerySet(model=None, query=None, using=None, hints=None)[source]

Custom models.QuerySet for Work

count_events()[source]

Annotate the queryset with counts for events, borrows, and purchases.

class mep.books.models.WorkSignalHandlers[source]

Signal handlers for indexing Work records when related records are saved or deleted.

static creator_change(sender, instance=None, raw=False, **_kwargs)[source]

reindex associated work when a creator record is changed

static creatortype_delete(sender, instance, **_kwargs)[source]

reindex all associated works when a creator type is deleted

static creatortype_save(sender, instance=None, raw=False, **_kwargs)[source]

reindex all associated works when a creator type is changed

static event_delete(sender, instance, **kwargs)[source]

when an event is delete, reindex people associated with the corresponding account.

static event_save(sender=None, instance=None, raw=False, **kwargs)[source]

when an event is saved, reindex associated work if there is one

static format_delete(sender, instance, **_kwargs)[source]

reindex all associated works when a format is deleted

static format_save(sender, instance=None, raw=False, **_kwargs)[source]

reindex associated work when a format is changed

static person_delete(sender, instance, **_kwargs)[source]

reindex all works associated via creator when a person is deleted

static person_save(sender, instance=None, raw=False, **_kwargs)[source]

reindex all works associated via creator when a person is saved

Views

class mep.books.views.WorkAutocomplete(**kwargs)[source]

Basic autocomplete lookup, for use with django-autocomplete-light and mep.books.models.Work for borrowing and purchasing events

get_queryset()[source]

Get a queryset filtered by query string. Only searches on title, mep id and notes for now, since that is all our stub records include.

class mep.books.views.WorkCardList(**kwargs)[source]

Card thumbnails for lending card associated with a single library member.

get_absolute_url()[source]

Full URI for work card list page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Get the context for this view.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of mep.footnotes.models.Footnote

class mep.books.views.WorkCirculation(**kwargs)[source]

Display a list of circulation events (borrows, purchases, etc) for an individual work.

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Get the context for this view.

get_queryset()[source]

Fetch all events associated with this work.

model

alias of mep.accounts.models.Event

class mep.books.views.WorkDetail(**kwargs)[source]

Detail page for a single library book.

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

model

alias of mep.books.models.Work

class mep.books.views.WorkLastModifiedListMixin(**kwargs)[source]

last modified mixin with common logic for all work detail views

get_solr_lastmodified_filters()[source]

filter solr query by item type and slug

class mep.books.views.WorkList(**kwargs)[source]

List page for searching and browsing library items.

form_class

alias of mep.books.forms.WorkSearchForm

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Add generated page labels to the view context.

get_form(*args, **kwargs)[source]

Return an instance of the form to be used in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_page_labels(paginator)[source]

generate labels for pagination

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

get_range_stats()[source]

Return the min and max for fields specified in WorkList’s stats_fields

Returns

Dictionary keyed on form field name with a tuple of (min, max) as integers. If stats are not returned from the field, the key is not added to a dictionary.

Return type

dict

model

alias of mep.books.models.Work

range_field_map = {'event_years': 'circulation_dates'}

mappings for Solr field names to form aliases

search_bib_query = '{!qf=$bib_qf pf=$bib_pf v=$bib_query}'

bib data query alias field syntax (configured defaults is edismax)

stats_fields = ('event_years',)

fields to generate stats on in self.get_ranges

class mep.books.views.WorkPastSlugMixin[source]

View mixin to handle redirects for previously used slugs. If the main view logic raises a 404, looks for a work by past slug; if one is found, redirects to the corresponding work detail page with the new slug.

get(request, *args, **kwargs)[source]

Handle a 404 on the default GET logic — if the slug matches a past slug, redirect to the equivalent url for that work; otherwise raise the 404.

Utils

Utility methods for generating slugs for works. Used in Work model save method and model migration.

mep.books.utils.creator_lastname(work)[source]

Get the lastname of the first creator (first author or first editor if no authors) on this work.

mep.books.utils.generate_sort_title(title)[source]

Generate sort title based on title. Removes leading punctuation and stop word.

mep.books.utils.nonstop_words(text)[source]

split text into words, remove stopwords, and return a list of all non-stopwords. Removes punctuation, including apostrophes within words.

mep.books.utils.work_slug(work, max_words=3)[source]

Generate a slug for a work. Uses last name of first author (or first editor if no author), and first few non-stopwords in the title.

Manage Commands

export books

Manage command to export book data for use by others.

Generates a CSV and JSON file including details on every book in the database, with bibliographic details and counts for all events, borrows, and purchases.

People

Django app to manage information about people associated with the Sylvia Beach lending library.

Models

class mep.people.models.Country(*args, **kwargs)[source]

Countries, for documenting nationalities of a Person or location of an Address

exception DoesNotExist
exception MultipleObjectsReturned
class mep.people.models.InfoURL(*args, **kwargs)[source]

Informational urls (other than VIAF) associated with a Person, e.g. Wikipedia page.

exception DoesNotExist
exception MultipleObjectsReturned
class mep.people.models.Location(*args, **kwargs)[source]

Locations for addresses associated with people and accounts

exception DoesNotExist
exception MultipleObjectsReturned
arrondissement()[source]

Get the arrondissement corresponding to a particular postal code in Paris. If the Location is not in Paris or doesn’t have a postal code, return None.

arrondissement_ordinal()[source]

Arrondissement in Frech ordinal notation, with superscript.

city

city or town

country

Country

footnotes

footnotes (Footnote)

latitude

latitude

longitude

longitude

name

optional name of the location (e.g., hotel)

street_address

street address

class mep.people.models.PastPersonSlug(*args, **kwargs)[source]

A slug that was previously associated with a person; preserved so that former slugs will resolve to the correct person.

exception DoesNotExist
exception MultipleObjectsReturned
person

person record this slug belonged to

slug

slug

class mep.people.models.Person(*args, **kwargs)[source]

Model for people in the MEP dataset

exception DoesNotExist
exception MultipleObjectsReturned
account_id()[source]

Return the id number of the person’s associated Account or empty string if not.

address_count()[source]

Number of documented addresses for this person, associated through their account.

admin_url()[source]

URL to edit this record in the admin site

birth_year

birth year

property card

Lending library card record associated with member account

death_year

death year

property firstname_last

Primary name in ‘firstname lastname’ format for display

footnotes

footnotes (Footnote)

gender

gender

get_absolute_url()[source]

Return the public url to view library member’s detail page

has_account()[source]

Return whether an instance of mep.accounts.models.Account exists for this person.

has_card()[source]

The library account for this person has an associated lending card

in_logbooks()[source]

is there data for this person in the logbooks?

index_data()[source]

data for indexing in Solr

is_creator()[source]

Return whether this person is a mep.books.models.Creator of an mep.books.models.Item .

is_organization

flag to indicate organization instead of person

classmethod items_to_index()[source]

Custom logic for finding items to be indexed when indexing in bulk; only include library members.

list_nationalities()[source]

Return comma separated list of nationalities (if any) for Person list_view.

mep_id

MEP xml id

name

names (first middle last)

nationalities

nationalities, link to Country

profession

Profession

public_notes

a field for notes publicly displayed on the website

relations

relationships to other people, via Relationship

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

Adds birth and death dates if they aren’t already set and there’s a viaf id for the record

set_birth_death_years()[source]

Set local birth and death dates based on information from VIAF

property short_name

Shortened form of name used for locations where space is tight, e.g. breadcrumb navigation

slug

slug for use in urls

sort_name

sort name; authorized name for people with VIAF

subscription_dates()[source]

Return a semi-colon separated list of mep.accounts.models.Subscription instances associated with this person’s account(s).

title

title

updated_at

update timestamp

validate_unique(exclude=None)[source]

Check unique constraints on the model and raise ValidationError if any failed.

verified

verified flag

property viaf

viapy.api.ViafEntity for this record if viaf_id is set.

viaf_id

viaf identifiers

class mep.people.models.PersonQuerySet(model=None, query=None, using=None, hints=None)[source]

Custom models.QuerySet for Person

library_members()[source]

Restrict queryset to people who are library members, based on associated account.

merge_with(person)[source]

Merge all person records in the current queryset with the specified person. This entails the following:

  • all events from accounts associated with people in the queryset are reassociated with the specified person

  • all addresses associated with people in the queryset or their accounts are reassociated with the specified person or their account

  • TODO: copy other details and update other relationships

  • after data has been copied over, people in the queryset and their accounts will be deleted

Raises an error if the specified person has more than one account or if any people in the queryset have an account associated with another person.

Parameters

personPerson person

Raises

django.core.exceptions.MultipleObjectsReturned – if selected Person has multiple accounts _or_ any person in the queryset has an account shared with another person

class mep.people.models.PersonSignalHandlers[source]

Signal handlers for indexing Person records when related records are saved or deleted.

static account_delete(sender, instance, **kwargs)[source]

when an account is deleted, reindex associated people before deletion is processed

static account_save(sender=None, instance=None, raw=False, **kwargs)[source]

when an account is saved, reindex associated people

static address_delete(sender, instance, **kwargs)[source]

when an address is deleted, reindex people associated with the corresponding account.

static address_save(sender=None, instance=None, raw=False, **kwargs)[source]

when an address is saved, reindex people associated with the corresponding account.

static country_delete(sender, instance, **kwargs)[source]

when a country is deleted, reindex any people associated via nationality before deletion is processed

static country_save(sender=None, instance=None, raw=False, **kwargs)[source]

when a country is saved, reindex any people associated via nationality

static debug_log(name, count)[source]

shared debug logging for person signal save handlers

static event_delete(sender, instance, **kwargs)[source]

when an event is delete, reindex people associated with the corresponding account.

static event_save(sender=None, instance=None, raw=False, **kwargs)[source]

when an event is saved, reindex people associated with the corresponding account.

class mep.people.models.Profession(*args, **kwargs)[source]

Profession for a Person

exception DoesNotExist
exception MultipleObjectsReturned
class mep.people.models.Relationship(*args, **kwargs)[source]

Through model for Person to self

exception DoesNotExist
exception MultipleObjectsReturned
class mep.people.models.RelationshipType(*args, **kwargs)[source]

Types of relationships between one Person and another

exception DoesNotExist
exception MultipleObjectsReturned

Forms

class mep.people.forms.MemberSearchForm(data=None, *args, **kwargs)[source]

Member search form

class mep.people.forms.PersonChoiceField(queryset, *, empty_label='---------', required=True, widget=None, label=None, initial=None, help_text='', to_field_name=None, limit_choices_to=None, **kwargs)[source]
label_from_instance(person)[source]

Convert objects into strings and generate the labels for the choices presented by this object. Subclasses can override this method to customize the display of the choices.

class mep.people.forms.PersonMergeForm(*args, **kwargs)[source]

Views

class mep.people.views.BorrowingActivities(**kwargs)[source]

Display a list of book-related activities (borrows, purchases, gifts) for an individual member.

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Get the context for this view.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of mep.accounts.models.Event

class mep.people.views.CountryAutocomplete(**kwargs)[source]

Basic autocomplete lookup, for use with django-autocomplete-light and mep.people.models.Person in nationalities many-to-many.

get_queryset()[source]

Country queryset, filtered on text in name (case-insensitive, partial match)

class mep.people.views.GeoNamesLookup(**kwargs)[source]

GeoNames ajax lookup for use as autocomplete. Optional mode parameter to restrict to countries only.

get(request, mode=None, *args, **kwargs)[source]

“Return option list json response.

get_label(item)[source]

display country for context, if available

class mep.people.views.LocationAutocomplete(**kwargs)[source]

Basic autocomplete lookup, for use with django-autocomplete-light and mep.people.models.Person in address many-to-many

get_queryset()[source]

Get queryset of mep.people.models.Location objects. Use Q objects to search all relevant fields in autocomplete.

class mep.people.views.MemberCardDetail(**kwargs)[source]

Card image viewer for image of a single lending card page associated with a single library member.

get_absolute_url()[source]

Full URI for member card list page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_object()[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

model

alias of djiffy.models.Canvas

class mep.people.views.MemberCardList(**kwargs)[source]

Card thumbnails for lending card associated with a single library member.

get_absolute_url()[source]

Full URI for member card list page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Get the context for this view.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of djiffy.models.Canvas

class mep.people.views.MemberDetail(**kwargs)[source]

Detail page for a single library member.

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Insert the single object into the context dict.

get_queryset()[source]

Return the QuerySet that will be used to look up the object.

This method is called by the default implementation of get_object() and may not be called if get_object() is overridden.

model

alias of mep.people.models.Person

class mep.people.views.MemberLastModifiedListMixin(**kwargs)[source]

last modified mixin with common logic for all single-member views

get_solr_lastmodified_filters()[source]

Get filters for last modified Solr query. By default returns solr_lastmodified_filters.

class mep.people.views.MemberPastSlugMixin[source]

View mixin to handle redirects for previously used slugs. If the main view logic raises a 404, looks for a library member by past slug; if one is found, redirects to the corresponding member detail page with the new slug.

class mep.people.views.MembersList(**kwargs)[source]

List page for searching and browsing library members.

form_class

alias of mep.people.forms.MemberSearchForm

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Add generated page labels to the view context.

get_form(*args, **kwargs)[source]

Return an instance of the form to be used in this view.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_page_labels(paginator)[source]

generate labels for pagination

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

get_range_stats()[source]

Return the min and max for fields specified in MembershipList’s stats_fields

Returns

Dictionary keyed on form field name with a tuple of (min, max) as integers. If stats are not returned from the field, the key is not added to a dictionary.

Return type

dict

initial = {'sort': 'name'}

initial form values

model

alias of mep.people.models.Person

range_field_map = {'account_years': 'membership_dates'}

mappings for Solr field names to form aliases

search_name_query = '{!qf=$name_qf pf=$name_pf v=$name_query}'

name query alias field syntax (type defaults to edismax in solr config)

stats_fields = ('account_years', 'birth_year')

fields to generate stats on in self.get_ranges

class mep.people.views.MembershipActivities(**kwargs)[source]

Display a list of membership activities (subscriptions, renewals, and reimbursements) for an individual member.

get_absolute_url()[source]

Get the full URI of this page.

get_breadcrumbs()[source]

Get the list of breadcrumbs and links to display for this page.

get_context_data(**kwargs)[source]

Get the context for this view.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of mep.accounts.models.Event

class mep.people.views.MembershipGraphs(**kwargs)[source]
model

alias of mep.people.models.Person

class mep.people.views.PersonAutocomplete(**kwargs)[source]

Basic person autocomplete lookup, for use with django-autocomplete-light. Use Q objects to help distinguish people using mepid.

get_queryset()[source]

Person queryset, filtered on text in name or MEP id (case-insensitive, partial match)

get_result_label(person)[source]

Provide a more detailed result label for the people autocomplete that can help disambiguate people.

class mep.people.views.PersonMerge(**kwargs)[source]

View method to merge one or more Person records. Displays PersonMergeForm on GET, processes merge with mep.people.models.PersonQuerySet.merge_with() on successful POST. Should be called with a list of person ids in the querystring as a comma-separated list. Created for use with custom admin action mep.people.admin.PersonAdmin.merge_people().

form_class

alias of mep.people.forms.PersonMergeForm

form_valid(form)[source]

If the form is valid, redirect to the supplied URL.

get_form_kwargs()[source]

Return the keyword arguments for instantiating the form.

get_initial()[source]

Return the initial data to use for forms on this view.

get_success_url()[source]

Redirect to the mep.people.models.Person change_list in the Django admin with pagination and filters preserved. Expects mep.people.admin.PersonAdmin.merge_people() to have set ‘people_merge_filter’ in the request’s session.

GeoNames

class mep.people.geonames.GeoNamesAPI[source]

Minimal wrapper around GeoNames API. Currently supports simple searching by name and generating a uri from an id. Expects GEONAMES_USERNAME to be configured in django settings.

call_api(method, params=None)[source]

Generic method to handle calling geonames api and raising an exception if an error occurred.

property countries

Country information as returned by countryInfoJSON.

countries_by_code

Dictionary of country information keyed on two-letter code.

search(query, max_rows=None, feature_class=None, feature_code=None, name_start=False)[source]

Search for places and return the list of results

classmethod uri_from_id(geonames_id)[source]

Convert a GeoNames id into a GeoNames URI

exception mep.people.geonames.GeoNamesError[source]

Generic GeoNames response error

exception mep.people.geonames.GeoNamesUnauthorized[source]

GeoNames unauthorized response (raised when username is not set)

Admin

class mep.people.admin.CountryAdmin(model, admin_site)[source]
form

alias of CountryAdminForm

class mep.people.admin.CountryAdminForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Custom model form for Place editing, used to add geonames lookup.

class mep.people.admin.GeoNamesLookupWidget(url=None, forward=None, *args, **kwargs)[source]

Customize autocomplete select widget to display Geonames URI as a link.

render(name, value, renderer=None, attrs=None)[source]

Call Django render together with render_forward_conf.

class mep.people.admin.InfoURLInline(parent_model, admin_site)[source]
model

alias of mep.people.models.InfoURL

class mep.people.admin.LocationAdmin(model, admin_site)[source]
form

alias of LocationAdminForm

class mep.people.admin.LocationAdminForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Custom model form for Address editing.

mapbox_token = None

add a hidden field to pass in a mapbox access token from local settings

class mep.people.admin.MapWidget(attrs=None)[source]

Customize numeric input and add a map div to display a leaflet map for latitude and longitude values on the form.

render(name, value, renderer=None, attrs=None)[source]

Render the widget as an HTML string.

class mep.people.admin.PersonAddressInline(parent_model, admin_site)[source]
class mep.people.admin.PersonAdmin(model, admin_site)[source]

ModelAdmin for Person. Uses custom template to display account subscription events and any relationships _to_ this person (only relationships to _other_ people are edited here).

csv_filename()[source]

Generate filename for CSV download

export_fields = ['id', 'name', 'sort_name', 'mep_id', 'account_id', 'birth_year', 'death_year', 'gender', 'title', 'profession', 'is_organization', 'is_creator', 'has_account', 'in_logbooks', 'has_card', 'subscription_dates', 'verified', 'updated_at', 'admin_url']

fields to be included in CSV export

export_to_csv(request, queryset=None)[source]

Stream tabular data as a CSV file

form

alias of PersonAdminForm

get_urls()[source]

Return admin urls; adds a custom URL for exporting all people as CSV

merge_people(request, queryset)[source]

Consolidate duplicate person records.

past_slugs_list(instance=None)[source]

list of previous slugs for this person, for read-only display

tabulate_queryset(queryset)[source]

Generator for data in tabular form, including custom fields

class mep.people.admin.PersonAdminForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Custom model form for Person editing; used to add VIAF lookup

class mep.people.admin.PersonTypeListFilter(request, params, model, model_admin)[source]

Filter that for Person that can distinguish between people who are creators of books vs. those who are library members.

lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

queryset(request, queryset)[source]

Return the filtered queryset.

class mep.people.admin.RelationshipInline(parent_model, admin_site)[source]

Inline class for Relationships

form

alias of RelationshipInlineForm

model

alias of mep.people.models.Relationship

class mep.people.admin.RelationshipInlineForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Custom model form for Book editing, used to add autocomplete for place lookup.

Manage Commands

export members

Manage command to export member data for use by others.

Generates a CSV and JSON file including details on every library member in the database, with summary details and coordinates for associated addresses.

Footnotes

Django app for footnotes that can be associated with other content anywhere in the project.

Models

class mep.footnotes.models.Bibliography(id, notes, bibliographic_note, source_type, manifest)[source]
exception DoesNotExist
exception MultipleObjectsReturned
footnote_count()[source]

number of footnotes this item is referenced in

index_data()[source]

data for indexing in Solr

classmethod index_item_type()[source]

Label for this kind of indexable item.

classmethod items_to_index()[source]

Custom logic for finding items for bulk indexing; only include records associated with an account and with a IIIF manifest.

manifest

digital version as instance of djiffy.models.Manifest

class mep.footnotes.models.BibliographySignalHandlers[source]

Signal handlers for indexing Bibliography records when related records are saved or deleted.

static account_delete(sender, instance, **kwargs)[source]

when an account is deleted, reindex any associated library lending card

static account_save(sender=None, instance=None, raw=False, **_kwargs)[source]

when an account is saved, reindex any associated library lending card.

static canvas_delete(sender, instance, **kwargs)[source]

when a canvas is deleted, reindex library lending card associated via manifest

static canvas_save(sender=None, instance=None, raw=False, **kwargs)[source]

when a canvas is saved, reindex library lending card associated via manifest

static debug_log(name, count, mode='save')[source]

shared debug logging for card signal save handlers

static event_delete(sender, instance, **kwargs)[source]

when an event is deleted, reindex library lending card associated via account

static event_save(sender=None, instance=None, raw=False, **_kwargs)[source]

when an event is saved, reindex library lending card associated via account

static manifest_delete(sender, instance, **kwargs)[source]

when a manifest is deleted, reindex associated library lending card

static manifest_save(sender=None, instance=None, raw=False, **kwargs)[source]

when a manifest is saved, reindex associated library lending card

static person_delete(sender, instance, **kwargs)[source]

when a person is deleted, reindex any bibliography card records associated through an account

static person_save(sender=None, instance=None, raw=False, **kwargs)[source]

when a person is saved, reindex bibliography card records associated through an account

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

Footnote that can be associated with any other model via generic relationship. Used to provide supporting documentation for or against information in the system.

exception DoesNotExist
exception MultipleObjectsReturned
image_thumbnail()[source]

Use admin thumbnail from image if available, but wrap in a link using rendering url from manifest when present

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

Custom models.QuerySet for Footnote

event_date_range()[source]

Find earliest and latest dates for any events associated with footnotes in this queryset. Returns a tuple of earliest and latest dates, or None if no dates are found.

events()[source]

Return an Events queryset for all events associated with the current footnote queryset.

on_events()[source]

Filter to footnotes that are associated with events

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

Type of source document.

exception DoesNotExist
exception MultipleObjectsReturned
item_count()[source]

number of associated bibliographic items