{% if export_url %}
    {% if export_templates or include_yaml_option %}
        <div class="btn-group">
            <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <span class="mdi mdi-database-export" aria-hidden="true"></span>
                Export <span class="caret"></span>
            </button>
            <ul class="dropdown-menu dropdown-menu-right">
                <li>
                    <form action="{{ export_url }}" method="post">
                        {% csrf_token %}
                        <input type="hidden" name="content_type" value="{{ content_type.pk }}">
                        <input type="hidden" name="query_string" value="{{ query_string }}">
                        <input type="hidden" name="_schedule_type" value="immediately">
                        <button type="submit" class="btn btn-link">CSV format</button>
                    </form>
                </li>
                {% if include_yaml_option %}
                    <li>
                        <form action="{{ export_url }}" method="post">
                            {% csrf_token %}
                            <input type="hidden" name="content_type" value="{{ content_type.pk }}">
                            <input type="hidden" name="query_string" value="{{ query_string }}">
                            <input type="hidden" name="export_format" value="yaml">
                            <input type="hidden" name="_schedule_type" value="immediately">
                            <button type="submit" class="btn btn-link">YAML format</button>
                        </form>
                    </li>
                {% endif %}
                {% if export_templates %}
                    <li class="divider"></li>
                    {% for et in export_templates %}
                        <li>
                            <form action="{{ export_url }}" method="post">
                                {% csrf_token %}
                                <input type="hidden" name="content_type" value="{{ content_type.pk }}">
                                <input type="hidden" name="export_template" value="{{ et.pk }}">
                                <input type="hidden" name="query_string" value="{{ query_string }}">
                                <input type="hidden" name="_schedule_type" value="immediately">
                                <button type="submit" class="btn btn-link"
                                    {% if et.description %}title="{{ et.description }}"{% endif %}
                                >{{ et.name }}</button>
                            </form>
                        </li>
                    {% endfor %}
                {% endif %}
            </ul>
        </div>
    {% else %}
        <form style="display: inline-block" action="{{ export_url }}" method="post">
            {% csrf_token %}
            <input type="hidden" name="content_type" value="{{ content_type.pk }}">
            <input type="hidden" name="query_string" value="{{ query_string }}">
            <input type="hidden" name="_schedule_type" value="immediately">
            <button type="submit" class="btn btn-success">
                <span class="mdi mdi-database-export" aria-hidden="true"></span> Export
            </button>
        </form>
    {% endif %}
{% endif %}
