9. Vidispine tags and filters¶
To make using vidispine easier in a theme a set of template tags have been created to help with common operations. To use you most load the vidispine tags into the current template:
{% load vidispinetags %}
- portal.utils.templatetags.vidispinetags.cssMimeTypes(value)¶
Returns css classes from a mimetype.
For example, if value is application/x-adobe-indesign this function will return:
mimetype-application mimetype-application-x-adobe-indesign
- portal.utils.templatetags.vidispinetags.getBestMediaFormat(value, arg)¶
Returns the best matching format of the item
- portal.utils.templatetags.vidispinetags.getCollectionMetadataFieldValueByName(value, arg)¶
Gets the value of a particular metadata field from an VS item object.
- portal.utils.templatetags.vidispinetags.getCollectionName(collection_id)¶
Returns a collection name for a given collection id
Usage: {{ collection_id_variable|getCollectionName }}
- portal.utils.templatetags.vidispinetags.getItemTypeLabel(item)¶
Returns a string representation of the item type
- portal.utils.templatetags.vidispinetags.getJobStatusLabel(value, arg)¶
Get a human readable label for a job status
- portal.utils.templatetags.vidispinetags.getJobTypeLabel(value, arg)¶
Get a human readable and translatable label for a job status
- portal.utils.templatetags.vidispinetags.getMetadataFieldByLabel(value, arg)¶
Gets a metadata field by label against a metadata field group
- portal.utils.templatetags.vidispinetags.getMetadataFieldByName(value, arg)¶
Gets the value of a particular metadata field from an VS item object.
- portal.utils.templatetags.vidispinetags.getMetadataFieldExtraDataValue(value, arg)¶
Gets the extradata value of a particular metadata field given a extradata key.
- portal.utils.templatetags.vidispinetags.getMetadataFieldHideIfNotSet(value, arg)¶
Get the boolean value of hide if not set for a metadata field given a specific group arg is the group name
- portal.utils.templatetags.vidispinetags.getMetadataFieldLabelByName(value, arg)¶
Gets the label of a particular metadata field from an VS item object.
- portal.utils.templatetags.vidispinetags.getMetadataFieldTypeByName(value, arg)¶
Gets the value of a particular metadata field from an VS item object.
- portal.utils.templatetags.vidispinetags.getMetadataFieldValueByName(value, arg)¶
Gets the value of a particular metadata field from an VS item object.
- portal.utils.templatetags.vidispinetags.getObjectByMimeType(value, arg)¶
For a list of previews and a list of MimeTypes in order return the object
- portal.utils.templatetags.vidispinetags.getObjectsByMimeType(value, arg)¶
For a list of previews and a list of MimeTypes in order return the objects that matches the mimetype
- portal.utils.templatetags.vidispinetags.getRepresentativeMetadata(value, arg)¶
Gets the representative metadata field names and values for an item and limits it to number given as value.
- portal.utils.templatetags.vidispinetags.getRepresentativeMetadataFields(value, arg)¶
Gets the representative metadata fields for an item and limits it to number given as value.
- portal.utils.templatetags.vidispinetags.getStorageNameFromId(value, arg)¶
Get the storage name from a list of storages using an id If not name is found the ID is returned
- portal.utils.templatetags.vidispinetags.getSytemMetadataFieldFormatted(value, arg)¶
Gets the system field value formatted.
- portal.utils.templatetags.vidispinetags.getURIByMimeType(value, arg)¶
For a list of previews, and a given MimeType return the URI to the preview file or return None. If none of the shapes contains the requested MimeType, then we look at the file extension.
- portal.utils.templatetags.vidispinetags.getUserRoleName(value, arg)¶
Returns a human readable name for the user roles
- portal.utils.templatetags.vidispinetags.preview_by_mime_type(context, preview_list, mime_type)¶
For a list of previews, and a given MimeType return the URI to the preview file or return None. Then look at the URI, if there is no SERVER_NAME or SERVER_PORT, we get that from the request context. This solves bug *#1903 where preview URI’s can be relative but the flash player needs an absolute URL. ReplaceURL in the portal.conf can remove the SERVER_NAME and SERVER_PORT.
test: portal.utils.tests.template_tags_test.TestVidispineTags.test_preview_by_mime_type manage.py test utils.TestVidispineTags.test_preview_by_mime_type