diff options
author | Matthew Lemon <y@yulqen.org> | 2024-09-12 12:06:13 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-09-12 12:06:13 +0100 |
commit | f1c3af915dcf2746dcd65082bf36a55fda6ee773 (patch) | |
tree | caf8e07cec9865b26f4397dcd83bef9cdbb42f5e | |
parent | 15b2dc965bfe2271d73476fcf9ff636c60113908 (diff) |
Moved Edit Engagement form to a template include
-rw-r--r-- | engagements/forms.py | 6 | ||||
-rw-r--r-- | engagements/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": "<small><em>YYYY-MM-DD</em></small>", - "proposed_end_date": "<small><em>YYYY-MM-DD</em></small>", + "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 @@ </div> </div> - <div class="mt-8 mx-auto border p-6 bg-white shadow-md rounded-lg"> - <h4 class="text-xl font-semibold mb-1">Enter main details:</h4> - <div class="px-2 pt-1 sm:p-2"> - <form method="post" class="space-y-6"> - {% csrf_token %} - <div> - {{ form.external_party.label_tag }} - <div class="my-2"> - {% 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 %} - <p class="text-red-500 text-sm">{{ error }}</p> - {% endfor %} - </div> - </div> + <!--Include the standard form here--> + {% include "engagements/snippets/standard_form.html" with form=form %} - <div> - {{ form.proposed_start_date.label_tag }} - <div class="my-2"> - {% 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" %} - </div> - </div> - <div> - {{ form.proposed_end_date.label_tag }} - <div class="my-2"> - {% 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" %} - </div> - {% for error in form.proposed_end_date.errors %} - <p class="text-red-500 text-sm">{{ error }}</p> - {% endfor %} - </div> - - <div> - {{ form.engagement_type.label_tag }} - <div class="my-2"> - {% 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 %} - <p class="text-red-500 text-sm">{{ error }}</p> - {% endfor %} - </div> - </div> - - <div> - {{ form.officers.label_tag }} - <div class="my-2"> - {% 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 %} - <p class="text-red-500 text-sm">{{ error }}</p> - {% endfor %} - </div> - </div> - - <div> - <button type="submit" - class="w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"> - Save - </button> - </div> - </form> - </div> - </div> </div> </div> </div> |