This repository was archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 233
This repository was archived by the owner on Mar 4, 2024. It is now read-only.
Actions don't display with django 3.2 #156
Copy link
Copy link
Open
Description
The changelist actions stopped showing correctly when upgrading to Django 3.2 (perhaps Django 3.x?). After some scouring, I've found the following need to be overridden to make them work:
In templates/admin/change_list.html add the following css override to revert a css change made by this library:
{% extends "admin/change_list.html" %}
{% load i18n admin_urls static admin_list %}
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}" />
{% if cl.formset %}
<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />
{% endif %}
{% if cl.formset or action_form %}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{% endif %}
{{ media.css }}
{% if not actions_on_top and not actions_on_bottom %}
<style>
#changelist table thead th:first-child {width: inherit}
</style>
{% endif %}
<style>
#changelist .actions span.all,
#changelist .actions span.action-counter,
#changelist .actions span.clear,
#changelist .actions span.question {
display: inline-block;
font-size: 13px;
margin: 0 0.5em;
}
</style>
{% endblock %}
and in templates/admin/actions.html add the following to set the actions to default hidden:
{% load i18n bootstrap_admin_template_tags %}
<div class="actions">
{% for field in action_form.visible_fields %}
<div class="input-group" title="{{ field.label }}">
{{ field|add_class:'form-control' }}
<span class="input-group-btn">
<button type="submit" class="btn btn-default" title="{% trans "Run the selected action" %}" name="index" value="{{ action_index|default:0 }}">{% trans "Go" %}</button>
</span>
</div>
{% endfor %}
{% for field in action_form.hidden_fields %}{{field}}{% endfor %}
{% if actions_selection_counter %}
<div class="info-actions">
<span class="action-counter label label-info" data-actions-icnt="{{ cl.result_list|length }}">{{ selection_note }}</span>
{% if cl.result_count != cl.result_list|length %}
<span class="all hidden label label-info">{{ selection_note_all }}</span>
<span class="question hidden label label-primary">
<a href="#" title="{% trans "Click here to select the objects across all pages" %}"><span class="glyphicon glyphicon-check"></span> {% blocktrans with cl.result_count as total_count %}Select all {{ total_count }} {{ module_name }}{% endblocktrans %}</a>
</span>
<span class="clear hidden label label-warning"><a href="#"><span class="glyphicon glyphicon-unchecked"></span> {% trans "Clear selection" %}</a></span>
{% endif %}
</div>
{% endif %}
</div>
Metadata
Metadata
Assignees
Labels
No labels