From 58b23647cd31e14bc1a690813c6a1bdd47488ce2 Mon Sep 17 00:00:00 2001 From: robinvandermolen Date: Mon, 11 Nov 2024 15:21:38 +0100 Subject: [PATCH] :card_file_box: [#4815] Change submission removal limit to 0 Allowing submissions to be deleted after 0 days (i.e. on the same day) --- ...configuration_submissions_removal_limit.py | 54 +++++++++++++++++ src/openforms/config/models/config.py | 8 +-- ..._all_submissions_removal_limit_and_more.py | 58 +++++++++++++++++++ src/openforms/forms/models/form.py | 8 +-- .../admin/form_design/DataRemoval.js | 8 +-- 5 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 src/openforms/config/migrations/0064_alter_globalconfiguration_submissions_removal_limit.py create mode 100644 src/openforms/forms/migrations/0105_alter_form_all_submissions_removal_limit_and_more.py diff --git a/src/openforms/config/migrations/0064_alter_globalconfiguration_submissions_removal_limit.py b/src/openforms/config/migrations/0064_alter_globalconfiguration_submissions_removal_limit.py new file mode 100644 index 0000000000..2640cc362c --- /dev/null +++ b/src/openforms/config/migrations/0064_alter_globalconfiguration_submissions_removal_limit.py @@ -0,0 +1,54 @@ +# Generated by Django 4.2.16 on 2024-11-11 14:08 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("config", "0063_merge_20240923_1612"), + ] + + operations = [ + migrations.AlterField( + model_name="globalconfiguration", + name="all_submissions_removal_limit", + field=models.PositiveIntegerField( + default=90, + help_text="Amount of days when all submissions will be permanently deleted", + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="all submissions removal limit", + ), + ), + migrations.AlterField( + model_name="globalconfiguration", + name="errored_submissions_removal_limit", + field=models.PositiveIntegerField( + default=30, + help_text="Amount of days errored submissions will remain before being removed", + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="errored submission removal limit", + ), + ), + migrations.AlterField( + model_name="globalconfiguration", + name="incomplete_submissions_removal_limit", + field=models.PositiveIntegerField( + default=7, + help_text="Amount of days incomplete submissions will remain before being removed", + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="incomplete submission removal limit", + ), + ), + migrations.AlterField( + model_name="globalconfiguration", + name="successful_submissions_removal_limit", + field=models.PositiveIntegerField( + default=7, + help_text="Amount of days successful submissions will remain before being removed", + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="successful submission removal limit", + ), + ), + ] diff --git a/src/openforms/config/models/config.py b/src/openforms/config/models/config.py index a616f8d15f..980e74e8fc 100644 --- a/src/openforms/config/models/config.py +++ b/src/openforms/config/models/config.py @@ -421,7 +421,7 @@ class GlobalConfiguration(SingletonModel): successful_submissions_removal_limit = models.PositiveIntegerField( _("successful submission removal limit"), default=7, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days successful submissions will remain before being removed" ), @@ -436,7 +436,7 @@ class GlobalConfiguration(SingletonModel): incomplete_submissions_removal_limit = models.PositiveIntegerField( _("incomplete submission removal limit"), default=7, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days incomplete submissions will remain before being removed" ), @@ -451,7 +451,7 @@ class GlobalConfiguration(SingletonModel): errored_submissions_removal_limit = models.PositiveIntegerField( _("errored submission removal limit"), default=30, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days errored submissions will remain before being removed" ), @@ -466,7 +466,7 @@ class GlobalConfiguration(SingletonModel): all_submissions_removal_limit = models.PositiveIntegerField( _("all submissions removal limit"), default=90, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_("Amount of days when all submissions will be permanently deleted"), ) diff --git a/src/openforms/forms/migrations/0105_alter_form_all_submissions_removal_limit_and_more.py b/src/openforms/forms/migrations/0105_alter_form_all_submissions_removal_limit_and_more.py new file mode 100644 index 0000000000..e3b54c84cc --- /dev/null +++ b/src/openforms/forms/migrations/0105_alter_form_all_submissions_removal_limit_and_more.py @@ -0,0 +1,58 @@ +# Generated by Django 4.2.16 on 2024-11-14 09:31 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("forms", "0104_select_datatype_string"), + ] + + operations = [ + migrations.AlterField( + model_name="form", + name="all_submissions_removal_limit", + field=models.PositiveIntegerField( + blank=True, + help_text="Amount of days when all submissions of this form will be permanently deleted. Leave blank to use value in General Configuration.", + null=True, + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="all submissions removal limit", + ), + ), + migrations.AlterField( + model_name="form", + name="errored_submissions_removal_limit", + field=models.PositiveIntegerField( + blank=True, + help_text="Amount of days errored submissions of this form will remain before being removed. Leave blank to use value in General Configuration.", + null=True, + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="errored submission removal limit", + ), + ), + migrations.AlterField( + model_name="form", + name="incomplete_submissions_removal_limit", + field=models.PositiveIntegerField( + blank=True, + help_text="Amount of days incomplete submissions of this form will remain before being removed. Leave blank to use value in General Configuration.", + null=True, + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="incomplete submission removal limit", + ), + ), + migrations.AlterField( + model_name="form", + name="successful_submissions_removal_limit", + field=models.PositiveIntegerField( + blank=True, + help_text="Amount of days successful submissions of this form will remain before being removed. Leave blank to use value in General Configuration.", + null=True, + validators=[django.core.validators.MinValueValidator(0)], + verbose_name="successful submission removal limit", + ), + ), + ] diff --git a/src/openforms/forms/models/form.py b/src/openforms/forms/models/form.py index b45ab28fdc..b08c994c73 100644 --- a/src/openforms/forms/models/form.py +++ b/src/openforms/forms/models/form.py @@ -295,7 +295,7 @@ class Form(models.Model): _("successful submission removal limit"), blank=True, null=True, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days successful submissions of this form will remain before being removed. " "Leave blank to use value in General Configuration." @@ -315,7 +315,7 @@ class Form(models.Model): _("incomplete submission removal limit"), blank=True, null=True, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days incomplete submissions of this form will remain before being removed. " "Leave blank to use value in General Configuration." @@ -335,7 +335,7 @@ class Form(models.Model): _("errored submission removal limit"), blank=True, null=True, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days errored submissions of this form will remain before being removed. " "Leave blank to use value in General Configuration." @@ -355,7 +355,7 @@ class Form(models.Model): _("all submissions removal limit"), blank=True, null=True, - validators=[MinValueValidator(1)], + validators=[MinValueValidator(0)], help_text=_( "Amount of days when all submissions of this form will be permanently deleted. " "Leave blank to use value in General Configuration." diff --git a/src/openforms/js/components/admin/form_design/DataRemoval.js b/src/openforms/js/components/admin/form_design/DataRemoval.js index 7c8811ea24..1eb1e06bbd 100644 --- a/src/openforms/js/components/admin/form_design/DataRemoval.js +++ b/src/openforms/js/components/admin/form_design/DataRemoval.js @@ -61,7 +61,7 @@ const DataRemoval = ({submissionsRemovalOptions, onChange}) => { @@ -109,7 +109,7 @@ const DataRemoval = ({submissionsRemovalOptions, onChange}) => { @@ -154,7 +154,7 @@ const DataRemoval = ({submissionsRemovalOptions, onChange}) => { /> } > - + @@ -198,7 +198,7 @@ const DataRemoval = ({submissionsRemovalOptions, onChange}) => { /> } > - +