From d3723c2ad37c0e38e22c776fe7cf8f12dcc5d50b Mon Sep 17 00:00:00 2001 From: vmm86 Date: Wed, 11 Apr 2018 00:33:23 +0300 Subject: [PATCH 1/3] Return to preserved filters on change_list after object action 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 --- .../django_object_actions/change_form.html | 24 ++++++++++--------- .../django_object_actions/change_list.html | 24 ++++++++++--------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/django_object_actions/templates/django_object_actions/change_form.html b/django_object_actions/templates/django_object_actions/change_form.html index 6084a35..307bcbf 100644 --- a/django_object_actions/templates/django_object_actions/change_form.html +++ b/django_object_actions/templates/django_object_actions/change_form.html @@ -1,17 +1,19 @@ {% extends "admin/change_form.html" %} - +{% load admin_urls %} {% block object-tools-items %} - {% for tool in objectactions %} + {% for tool in objectactions %}
  • - - {{ tool.label|capfirst }} - + {% url tools_view_name pk=object_id tool=tool.name as action_url %} + + {{ tool.label|capfirst }} +
  • - {% endfor %} - {{ block.super }} + {% endfor %} + {{ block.super }} {% endblock %} diff --git a/django_object_actions/templates/django_object_actions/change_list.html b/django_object_actions/templates/django_object_actions/change_list.html index a79c7c2..24ae790 100644 --- a/django_object_actions/templates/django_object_actions/change_list.html +++ b/django_object_actions/templates/django_object_actions/change_list.html @@ -1,17 +1,19 @@ {% extends "admin/change_list.html" %} - +{% load admin_urls %} {% block object-tools-items %} - {% for tool in objectactions %} + {% for tool in objectactions %}
  • - - {{ tool.label|capfirst }} - + {% url tools_view_name pk=object_id tool=tool.name as action_url %} + + {{ tool.label|capfirst }} +
  • - {% endfor %} - {{ block.super }} + {% endfor %} + {{ block.super }} {% endblock %} From 03b51445f69a3874504333743bb4fde1ad1785f6 Mon Sep 17 00:00:00 2001 From: vmm86 Date: Wed, 11 Apr 2018 09:54:39 +0300 Subject: [PATCH 2/3] Changes after pull request: Load add_preserved_filters from admin_urls --- .../templates/django_object_actions/change_form.html | 2 +- .../templates/django_object_actions/change_list.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django_object_actions/templates/django_object_actions/change_form.html b/django_object_actions/templates/django_object_actions/change_form.html index 307bcbf..eb21e09 100644 --- a/django_object_actions/templates/django_object_actions/change_form.html +++ b/django_object_actions/templates/django_object_actions/change_form.html @@ -1,5 +1,5 @@ {% extends "admin/change_form.html" %} -{% load admin_urls %} +{% load add_preserved_filters from admin_urls %} {% block object-tools-items %} {% for tool in objectactions %} diff --git a/django_object_actions/templates/django_object_actions/change_list.html b/django_object_actions/templates/django_object_actions/change_list.html index 24ae790..758e970 100644 --- a/django_object_actions/templates/django_object_actions/change_list.html +++ b/django_object_actions/templates/django_object_actions/change_list.html @@ -1,5 +1,5 @@ {% extends "admin/change_list.html" %} -{% load admin_urls %} +{% load add_preserved_filters from admin_urls %} {% block object-tools-items %} {% for tool in objectactions %} From b90a7c8f41142c836917b452d8192088711780de Mon Sep 17 00:00:00 2001 From: vmm86 Date: Wed, 11 Apr 2018 10:03:56 +0300 Subject: [PATCH 3/3] Changes after pull request: Indentation presumably reverted to original style --- .../django_object_actions/change_form.html | 23 +++++++++---------- .../django_object_actions/change_list.html | 23 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/django_object_actions/templates/django_object_actions/change_form.html b/django_object_actions/templates/django_object_actions/change_form.html index eb21e09..1b0f80d 100644 --- a/django_object_actions/templates/django_object_actions/change_form.html +++ b/django_object_actions/templates/django_object_actions/change_form.html @@ -2,18 +2,17 @@ {% load add_preserved_filters from admin_urls %} {% block object-tools-items %} - {% for tool in objectactions %} + {% for tool in objectactions %}
  • - {% url tools_view_name pk=object_id tool=tool.name as action_url %} - - {{ tool.label|capfirst }} - + {% url tools_view_name pk=object_id tool=tool.name as action_url %} + + {{ tool.label|capfirst }} +
  • - {% endfor %} - {{ block.super }} + {% endfor %} + {{ block.super }} {% endblock %} diff --git a/django_object_actions/templates/django_object_actions/change_list.html b/django_object_actions/templates/django_object_actions/change_list.html index 758e970..14352cb 100644 --- a/django_object_actions/templates/django_object_actions/change_list.html +++ b/django_object_actions/templates/django_object_actions/change_list.html @@ -2,18 +2,17 @@ {% load add_preserved_filters from admin_urls %} {% block object-tools-items %} - {% for tool in objectactions %} + {% for tool in objectactions %}
  • - {% url tools_view_name pk=object_id tool=tool.name as action_url %} - - {{ tool.label|capfirst }} - + {% url tools_view_name pk=object_id tool=tool.name as action_url %} + + {{ tool.label|capfirst }} +
  • - {% endfor %} - {{ block.super }} + {% endfor %} + {{ block.super }} {% endblock %}