Code Documentation¶
Models¶
- class djiffy.models.Canvas(*args, **kwargs)[source]¶
Minimal db model representation of a canvas from an IIIF manifest
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- extra_data¶
extra data not otherwise given its own field, serialized as json
- iiif_image_id¶
URL of IIIF image for this canvas
- label¶
label
- next()[source]¶
Next canvas after this one in sequence (within manifest primary sequence). Returns an empty queryset if there is no next canvas.
- order¶
order of this canvas within associated manifest primary sequence
- property plain_text_url¶
Return plain text url for a canvas if one exists
- prev()[source]¶
Previous canvas before this one in sequence (within manifest primary sequence). Returns an empty queryset if there is no next canvas.
- short_id¶
short id extracted from URI
- thumbnail¶
boolean flag to indicate if this canvas should be used as thumbnail
- uri¶
URI
- class djiffy.models.IIIFImage(api_endpoint=None, image_id=None, region=None, size=None, rotation=None, quality=None, fmt=None)[source]¶
Subclass of
piffle.iiif.IIIFImageClient
, for generating IIIF Image URIs for manifest canvas images.- mini_thumbnail_size = 100¶
long edge size for mini thumbnail
- single_page_size = 1000¶
long edge size for single page display
- thumbnail_size = 300¶
long edge size for thumbnail
- class djiffy.models.IIIFPresentation(*args, **kwargs)[source]¶
Extend iiif presentation class to add support for auth tokens when making requests on iiif urls.
- class djiffy.models.Manifest(*args, **kwargs)[source]¶
Minimal db model representation of an IIIF presentation manifest
- exception DoesNotExist¶
- exception MultipleObjectsReturned¶
- property attribution¶
manifest attribution, if there is one
- created¶
date local manifest cache was created
- property creativecommons_id¶
short id for creative commons license
- extra_data¶
extra data provided via a ‘seeAlso’ reference
- label¶
label
- last_modified¶
date local manifest cache was last modified
- property license¶
manifest license, if there is one
- property license_image¶
license image, if we can generate one
- license_label(lang='en')[source]¶
Get the text label for the rights license. Uses local value from edm rights if available; otherwise uses data for the URI to get the preferred label or title.
- property license_uri¶
manifest license as
rdflib.URIRef
, if there is a license
- property logo¶
manifest logo, if there is one
- metadata¶
iiif presentation metadata for display
- property rights_statement_id¶
short id for rightstatement.org license
- short_id¶
short id extracted from URI
- property thumbnail¶
thumbnail url for associated canvas
- uri¶
URI
Views¶
- class djiffy.views.CanvasAutocomplete(**kwargs)[source]¶
Canvas autocomplete view, e.g. for admin interface lookup
- class djiffy.views.CanvasDetail(**kwargs)[source]¶
Detail view for a single
Canvas
. Rendered with djiffy/canvast_detail.html template.
- class djiffy.views.ManifestDetail(**kwargs)[source]¶
Detail view for a single
Manifest
. Rendered with djiffy/manifest_detail.html template.
Import¶
- class djiffy.importer.ManifestImporter(stdout=None, stderr=None, style=None, update=False)[source]¶
Manifest importer. Intended for use with Django manage commands.
- Parameters:
stdout – optional stdout, if status output is desired
stderr – optional stderr, if error output is desired
style – optional django command style object, for styled output
- canvas_short_id(canvas)[source]¶
Method for generating short id from canvas; default is
piffle.presentation.IIIFPresentation.short_id()
.
- error_msg(msg)[source]¶
Output an error message if stderr is configured (used to support output via manage command).
- import_collection(manifest)[source]¶
Process a single IIIF collection and import all supported manifests referenced in the collection.
- Parameters:
manifest –
IIIFPresentation
- import_manifest(manifest, path)[source]¶
Process a single IIIF manifest and create
Manifest
andCanvas
objects.- Parameters:
manifest –
IIIFPresentation
path – file or url import path
- import_paths(paths)[source]¶
Import a list of paths - file or url, collection or manifest. Returns a list of imported manifests (includes previously imported objects for the requested URIs, if already in the database).
Manage Commands¶
Import manifest¶
Generic manage command for importing IIIF Collections or manifests into the database. Supports collections and individual manifests, and local file paths as well as URLs.