From 71b40f365512cf429e679c3ec7912b0374a894ce Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 12 Sep 2024 12:06:13 +0100 Subject: Moved Edit Engagement form to a template include --- engagements/forms.py | 6 ++- .../templates/engagements/engagement_form.html | 61 +--------------------- 2 files changed, 6 insertions(+), 61 deletions(-) diff --git a/engagements/forms.py b/engagements/forms.py index cccaf3b..401d6a9 100644 --- a/engagements/forms.py +++ b/engagements/forms.py @@ -225,8 +225,10 @@ class EngagementCreateForm(forms.ModelForm): "officers": "Inspectors", } help_texts = { - "proposed_start_date": "YYYY-MM-DD", - "proposed_end_date": "YYYY-MM-DD", + "external_party": "These are the people you are dealing with.", + "proposed_start_date": "YYYY-MM-DD", + "proposed_end_date": "YYYY-MM-DD", + "officers": "Use CTRL to select multiple if required.", } widgets = { "proposed_start_date": forms.DateInput(attrs={"type": "date"}), diff --git a/engagements/templates/engagements/engagement_form.html b/engagements/templates/engagements/engagement_form.html index 89f6b0e..0b5cd8b 100644 --- a/engagements/templates/engagements/engagement_form.html +++ b/engagements/templates/engagements/engagement_form.html @@ -30,67 +30,10 @@ -
-

Enter main details:

-
-
- {% csrf_token %} -
- {{ form.external_party.label_tag }} -
- {% render_field form.external_party class+="block w-full rounded-md border-0 p-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %} - {% for error in form.external_party.errors %} -

{{ error }}

- {% endfor %} -
-
+ + {% include "engagements/snippets/standard_form.html" with form=form %} -
- {{ form.proposed_start_date.label_tag }} -
- {% render_field form.proposed_start_date class+="block w-full rounded-md border-0 p-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %} -
-
-
- {{ form.proposed_end_date.label_tag }} -
- {% render_field form.proposed_end_date class+="block w-full rounded-md border-0 p-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %} -
- {% for error in form.proposed_end_date.errors %} -

{{ error }}

- {% endfor %} -
- -
- {{ form.engagement_type.label_tag }} -
- {% render_field form.engagement_type class+="block w-full rounded-md border-0 p-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %} - {% for error in form.engagement_type.errors %} -

{{ error }}

- {% endfor %} -
-
- -
- {{ form.officers.label_tag }} -
- {% render_field form.officers class+="block w-full rounded-md border-0 p-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" %} - {% for error in form.officers.errors %} -

{{ error }}

- {% endfor %} -
-
- -
- -
-
-
-
-- cgit v1.2.3