{% extends "admin/index.html" %}
{% load i18n %}

{% block content %}
    {{ block.super }}
    {% if not app_label %}
        {% if perms.cms_qe_auth.accessapi_user or perms.auth.add_permission %}
            <div class="module">
                <table>
                    <caption><h3>REST API</h3></caption>
                    <tbody>
                        <tr scope="row">
                            <td><a href="{% url "api-root" %}">{% url "api-root" %}</a></td>
                        </tr>
                        <tr scope="row">
                            <td><a href="{% url "api-root" %}schema/swagger/">{% url "api-root" %}schema/swagger/</a></td>
                        </tr>
                        <tr scope="row">
                            <td><a href="{% url "api-root" %}schema/redoc/">{% url "api-root" %}schema/redoc/</a></td>
                        </tr>
                    </tbody>
                </table>
                {% if perms.auth.add_permission %}
                    <p>
                        {% blocktranslate trimmed %}
                            To log into the API, the user needs to have the access permission assigned.
                            To access other records in the API, the user must have the VIEW permission set for the model.
                        {% endblocktranslate %}
                    </p>
                    <div>{% translate "For example:" %}</div>
                    <div><code>cms_qe_auth | user | Can access to the API</code></div>
                    <div><code>aldryn_forms | Form submission | Can view Form submission</code></div>
                    <div><code>aldryn_forms | Form plugin | Can view Form plugin</code></div>
                {% endif %}
            </div>
        {% endif %}
    {% endif %}
{% endblock %}
