From f248d3db74ca895b78f1f74514c9e154d297687d Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Thu, 29 Feb 2024 15:04:42 +0100 Subject: [PATCH 1/3] add id html to Django admin template --- .../templates/admin/includes/fieldset.html | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 lemarche/templates/admin/includes/fieldset.html diff --git a/lemarche/templates/admin/includes/fieldset.html b/lemarche/templates/admin/includes/fieldset.html new file mode 100644 index 000000000..b27e6f6f5 --- /dev/null +++ b/lemarche/templates/admin/includes/fieldset.html @@ -0,0 +1,35 @@ +
+ {% if fieldset.name %}

{{ fieldset.name }}

{% endif %} + {% if fieldset.description %} +
{{ fieldset.description|safe }}
+ + {% endif %} + {% for line in fieldset %} +
+ {% if line.fields|length == 1 %}{{ line.errors }}{% else %}
{% endif %} + {% for field in line %} +
+ {% if not line.fields|length == 1 and not field.is_readonly %}{{ field.errors }}{% endif %} +
+ {% if field.is_checkbox %} + {{ field.field }}{{ field.label_tag }} + {% else %} + {{ field.label_tag }} + {% if field.is_readonly %} +
{{ field.contents }}
+ {% else %} + {{ field.field }} + {% endif %} + {% endif %} +
+ {% if field.field.help_text %} +
+
{{ field.field.help_text|safe }}
+
+ {% endif %} +
+ {% endfor %} + {% if not line.fields|length == 1 %}
{% endif %} +
+ {% endfor %} +
\ No newline at end of file From 73b57602659d0d66ab6bb760925ca182a8da6845 Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Thu, 29 Feb 2024 15:05:32 +0100 Subject: [PATCH 2/3] redirect to structures after save --- lemarche/tenders/admin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lemarche/tenders/admin.py b/lemarche/tenders/admin.py index 44a088a6a..b9fb1e516 100644 --- a/lemarche/tenders/admin.py +++ b/lemarche/tenders/admin.py @@ -627,7 +627,7 @@ def response_change(self, request, obj: Tender): if request.POST.get("_calculate_tender"): obj.set_siae_found_list() self.message_user(request, "Les structures concernées ont été mises à jour.") - return HttpResponseRedirect(".") + return HttpResponseRedirect("./#structures") # redirect to structures sections if request.POST.get("_validate_tender"): obj.set_validated() self.message_user(request, "Ce dépôt de besoin a été validé. Il sera envoyé en temps voulu :)") From ed795d63fce048546ef389c5deac2887e73452cd Mon Sep 17 00:00:00 2001 From: "madjid.asa" Date: Thu, 29 Feb 2024 17:48:33 +0100 Subject: [PATCH 3/3] add comment to explain --- lemarche/templates/admin/includes/fieldset.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lemarche/templates/admin/includes/fieldset.html b/lemarche/templates/admin/includes/fieldset.html index b27e6f6f5..953c5302c 100644 --- a/lemarche/templates/admin/includes/fieldset.html +++ b/lemarche/templates/admin/includes/fieldset.html @@ -1,3 +1,9 @@ +{% comment %} +This page is an enhanced version of the original template found at +https://github.com/django/django/blob/main/django/contrib/admin/templates/admin/includes/fieldset.html. +We've updated it to include unique IDs for section titles, enabling direct navigation to specific sections. +This modification makes it easier for users to quickly find the information they need by allowing direct links to jump to different parts of the page. +{% endcomment %}
{% if fieldset.name %}

{{ fieldset.name }}

{% endif %} {% if fieldset.description %}