Skip to content

Commit fb90869

Browse files
vmmcrccheck
vmm
authored andcommitted
Return to preserved filters on change_list after object action (#88)
If you want to filter change_list by some conditions, then open each object and run some object action there, you will be returned to change_list with the same preserved filters. Fix #83 * Return to preserved filters on change_list after object action * Changes after pull request: Load add_preserved_filters from admin_urls * Changes after pull request: Indentation presumably reverted to original style
1 parent a390027 commit fb90869

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

django_object_actions/templates/django_object_actions/change_form.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{% extends "admin/change_form.html" %}
2-
2+
{% load add_preserved_filters from admin_urls %}
33

44
{% block object-tools-items %}
55
{% for tool in objectactions %}
66
<li class="objectaction-item" data-tool-name="{{ tool.name }}">
7-
<a href='{% url tools_view_name pk=object_id tool=tool.name %}' title="{{ tool.standard_attrs.title }}"
7+
{% url tools_view_name pk=object_id tool=tool.name as action_url %}
8+
<a href="{% add_preserved_filters action_url %}" title="{{ tool.standard_attrs.title }}"
89
{% for k, v in tool.custom_attrs.items %}
910
{{ k }}="{{ v }}"
1011
{% endfor %}

django_object_actions/templates/django_object_actions/change_list.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
{% extends "admin/change_list.html" %}
2-
2+
{% load add_preserved_filters from admin_urls %}
33

44
{% block object-tools-items %}
55
{% for tool in objectactions %}
66
<li class="objectaction-item" data-tool-name="{{ tool.name }}">
7-
<a href='{% url tools_view_name tool=tool.name %}' title="{{ tool.standard_attrs.title }}"
7+
{% url tools_view_name pk=object_id tool=tool.name as action_url %}
8+
<a href="{% add_preserved_filters action_url %}" title="{{ tool.standard_attrs.title }}"
89
{% for k, v in tool.custom_attrs.items %}
910
{{ k }}="{{ v }}"
1011
{% endfor %}

0 commit comments

Comments
 (0)