From 546120af68df36fe0638ad87183556460619e7ac Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:48:12 +0200 Subject: [PATCH] Add disclaimer_notes to edit_note --- .../0217_system_settings_disclaimer_notif.py | 21 +++++++++++++++++++ dojo/forms.py | 2 +- dojo/templates/dojo/edit_note.html | 6 ++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 dojo/db_migrations/0217_system_settings_disclaimer_notif.py diff --git a/dojo/db_migrations/0217_system_settings_disclaimer_notif.py b/dojo/db_migrations/0217_system_settings_disclaimer_notif.py new file mode 100644 index 00000000000..785142e8787 --- /dev/null +++ b/dojo/db_migrations/0217_system_settings_disclaimer_notif.py @@ -0,0 +1,21 @@ +# Generated by Django 5.0.8 on 2024-09-12 18:22 + +from django.db import migrations + + +def copy_notif_field(apps, schema_editor): + system_settings_model = apps.get_model('dojo', 'System_Settings') + if system_settings_model.disclaimer_notifications: + system_settings_model.disclaimer_reports = system_settings_model.disclaimer_notifications + system_settings_model.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('dojo', '0216_system_settings_disclaimer_notif'), + ] + + operations = [ + migrations.RunPython(copy_notif_field), + ] diff --git a/dojo/forms.py b/dojo/forms.py index 763cf55907a..e2c8cf5c07f 100644 --- a/dojo/forms.py +++ b/dojo/forms.py @@ -2289,7 +2289,7 @@ def __init__(self, *args, **kwargs): if get_system_setting("disclaimer_reports_forced"): self.fields["include_disclaimer"].disabled = True self.fields["include_disclaimer"].initial = "1" # represents yes - self.fields["include_disclaimer"].help_text="Administrator of the system enforced placement of disclaimer in all reports. You are not able exclude disclaimer from this report." + self.fields["include_disclaimer"].help_text = "Administrator of the system enforced placement of disclaimer in all reports. You are not able exclude disclaimer from this report." class CustomReportOptionsForm(forms.Form): diff --git a/dojo/templates/dojo/edit_note.html b/dojo/templates/dojo/edit_note.html index b85a1fa070f..9688855d8c2 100644 --- a/dojo/templates/dojo/edit_note.html +++ b/dojo/templates/dojo/edit_note.html @@ -3,6 +3,12 @@ {% block content %} {{ block.super }}

{% trans "Edit Note" %}


+ {% if system_settings.disclaimer_notes %} +
+ Disclaimer
+

{{ system_settings.disclaimer_notes }}

+
+ {% endif %}
{% csrf_token %} {% include "dojo/form_fields.html" with form=form %}