From a6a8e0692f3da74e3d7e7cfe91ce72f560366dc0 Mon Sep 17 00:00:00 2001 From: Wiktor Latanowicz Date: Sat, 18 Nov 2023 21:18:35 +0100 Subject: [PATCH 1/2] Improve forms: better layout and allow file uplaods --- .../templates/django_object_actions/change_form.html | 2 +- .../templates/django_object_actions/change_list.html | 2 +- .../templates/django_object_actions/modal_form.html | 4 ++-- 3 files changed, 4 insertions(+), 4 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 60b1783..11f4d1e 100644 --- a/django_object_actions/templates/django_object_actions/change_form.html +++ b/django_object_actions/templates/django_object_actions/change_form.html @@ -34,7 +34,7 @@ {% if tool.has_inline_form %} {% url tools_view_name pk=object_id tool=tool.name as action_url %}
-
+ {% csrf_token %}
    {{ tool.form.as_ul }} 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 906ef0c..8085d69 100644 --- a/django_object_actions/templates/django_object_actions/change_list.html +++ b/django_object_actions/templates/django_object_actions/change_list.html @@ -34,7 +34,7 @@ {% if tool.has_inline_form %} {% url tools_view_name tool=tool.name as action_url %}
    - + {% csrf_token %}
      {{ tool.form.as_ul }} diff --git a/django_object_actions/templates/django_object_actions/modal_form.html b/django_object_actions/templates/django_object_actions/modal_form.html index cbb87be..f15d95e 100644 --- a/django_object_actions/templates/django_object_actions/modal_form.html +++ b/django_object_actions/templates/django_object_actions/modal_form.html @@ -3,9 +3,9 @@ {% block content %}
      - + {% csrf_token %} - {{ form.as_table }} + {{ form.as_p }}
      From 7a73723b666c372b803e1c5121f6b31e29474272 Mon Sep 17 00:00:00 2001 From: Wiktor Latanowicz Date: Sat, 18 Nov 2023 21:24:25 +0100 Subject: [PATCH 2/2] Black --- example_project/polls/admin.py | 2 -- example_project/polls/migrations/0001_initial.py | 1 - example_project/polls/migrations/0002_auto_20200805_0239.py | 1 - 3 files changed, 4 deletions(-) diff --git a/example_project/polls/admin.py b/example_project/polls/admin.py index f77e21a..cef23fe 100644 --- a/example_project/polls/admin.py +++ b/example_project/polls/admin.py @@ -174,7 +174,6 @@ def get_change_actions(self, request, object_id, form_url): class CommentAdmin(DjangoObjectActions, admin.ModelAdmin): - # Object actions ################ @@ -192,7 +191,6 @@ def hodor(self, request, obj): class RelatedDataAdmin(DjangoObjectActions, admin.ModelAdmin): - # Object actions ################ diff --git a/example_project/polls/migrations/0001_initial.py b/example_project/polls/migrations/0001_initial.py index 5b9a1fd..a96df65 100644 --- a/example_project/polls/migrations/0001_initial.py +++ b/example_project/polls/migrations/0001_initial.py @@ -7,7 +7,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [] diff --git a/example_project/polls/migrations/0002_auto_20200805_0239.py b/example_project/polls/migrations/0002_auto_20200805_0239.py index 89b74af..599d26d 100644 --- a/example_project/polls/migrations/0002_auto_20200805_0239.py +++ b/example_project/polls/migrations/0002_auto_20200805_0239.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - dependencies = [ ("polls", "0001_initial"), ]