Class template

Example of a class item template customised for the mediatypes dataset:

{% extends "layout.html" %}

    {% block content %}
    <h1>{{ mediatype }}</h1>
    <h3><a href="{{ request.values.get('uri') }}">{{ request.values.get('uri') }}</a></h3>
        <li><a href="{{ mediatype }}">{{ mediatype }}</a></li>
    {% if deets['contributors'] is not none %}
    {% for contributor in deets['contributors'] %}
        <li><a href="{{ contributor }}">{{ contributor }}</a></li>
    {% endfor %}
    {% endif %}
    <h3>Other profiles, formats and languages:</h3>
    <ul><li><a href="{{ request.base_url }}?uri={{ request.values.get('uri') }}&_view=alternates">Alternate Views</a></li></ul>
{% endblock %}

Variables used by the class instance template:

This will be called within a custom Renderer class’ render(). See Custom Renderer.

return render_template(
    'mediatype-en.html',    # the class item template
    deets=deets,            # a python dict containing keys *label* and *contributors* to its respective values.
    mediatype=mediatype     # the mediatype class instance item name