From 13e74408d79023ed6b59ab1205b7853ab9479d53 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 --- ... 0218_system_settings_disclaimer_notif.py} | 2 +- .../0219_system_settings_disclaimer_notif.py | 21 +++++++++++++++++++ dojo/forms.py | 2 +- dojo/templates/dojo/edit_note.html | 6 ++++++ 4 files changed, 29 insertions(+), 2 deletions(-) rename dojo/db_migrations/{0216_system_settings_disclaimer_notif.py => 0218_system_settings_disclaimer_notif.py} (97%) create mode 100644 dojo/db_migrations/0219_system_settings_disclaimer_notif.py diff --git a/dojo/db_migrations/0216_system_settings_disclaimer_notif.py b/dojo/db_migrations/0218_system_settings_disclaimer_notif.py similarity index 97% rename from dojo/db_migrations/0216_system_settings_disclaimer_notif.py rename to dojo/db_migrations/0218_system_settings_disclaimer_notif.py index 35dc31d13ab..6d966e414a0 100644 --- a/dojo/db_migrations/0216_system_settings_disclaimer_notif.py +++ b/dojo/db_migrations/0218_system_settings_disclaimer_notif.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('dojo', '0215_webhooks_notifications'), + ('dojo', '0217_jira_project_enabled'), ] operations = [ diff --git a/dojo/db_migrations/0219_system_settings_disclaimer_notif.py b/dojo/db_migrations/0219_system_settings_disclaimer_notif.py new file mode 100644 index 00000000000..6d162940f2a --- /dev/null +++ b/dojo/db_migrations/0219_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', '0218_system_settings_disclaimer_notif'), + ] + + operations = [ + migrations.RunPython(copy_notif_field), + ] diff --git a/dojo/forms.py b/dojo/forms.py index 031c70a6c97..d6f5513bc77 100644 --- a/dojo/forms.py +++ b/dojo/forms.py @@ -2293,7 +2293,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 %}