Skip to content

Commit

Permalink
Return to preserved filters on change_list after object action (#88)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vmm authored and crccheck committed Apr 12, 2018
1 parent a390027 commit fb90869
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% extends "admin/change_form.html" %}

{% load add_preserved_filters from admin_urls %}

{% block object-tools-items %}
{% for tool in objectactions %}
<li class="objectaction-item" data-tool-name="{{ tool.name }}">
<a href='{% url tools_view_name pk=object_id tool=tool.name %}' title="{{ tool.standard_attrs.title }}"
{% url tools_view_name pk=object_id tool=tool.name as action_url %}
<a href="{% add_preserved_filters action_url %}" title="{{ tool.standard_attrs.title }}"
{% for k, v in tool.custom_attrs.items %}
{{ k }}="{{ v }}"
{% endfor %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{% extends "admin/change_list.html" %}

{% load add_preserved_filters from admin_urls %}

{% block object-tools-items %}
{% for tool in objectactions %}
<li class="objectaction-item" data-tool-name="{{ tool.name }}">
<a href='{% url tools_view_name tool=tool.name %}' title="{{ tool.standard_attrs.title }}"
{% url tools_view_name pk=object_id tool=tool.name as action_url %}
<a href="{% add_preserved_filters action_url %}" title="{{ tool.standard_attrs.title }}"
{% for k, v in tool.custom_attrs.items %}
{{ k }}="{{ v }}"
{% endfor %}
Expand Down

0 comments on commit fb90869

Please sign in to comment.