From d88d5f81a44f5ba73ffc1268f0e89034c956909a Mon Sep 17 00:00:00 2001 From: Val Hendrix Date: Fri, 9 Feb 2024 12:58:09 -0800 Subject: [PATCH] feat(dataset): limit funding org to 1024 characters Closes #424 --- ...lter_historicaldataset_options_and_more.py | 22 ++++++++++++++++++ ..._dataset_funding_organizations_and_more.py | 23 +++++++++++++++++++ archive_api/models.py | 2 +- ui/static/js/app.js | 2 +- ui/static/js/metadata/dataset.json | 2 +- 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 archive_api/migrations/0028_alter_historicaldataset_options_and_more.py create mode 100644 archive_api/migrations/0029_alter_dataset_funding_organizations_and_more.py diff --git a/archive_api/migrations/0028_alter_historicaldataset_options_and_more.py b/archive_api/migrations/0028_alter_historicaldataset_options_and_more.py new file mode 100644 index 00000000..1d224010 --- /dev/null +++ b/archive_api/migrations/0028_alter_historicaldataset_options_and_more.py @@ -0,0 +1,22 @@ +# Generated by Django 4.2.2 on 2024-02-09 20:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive_api', '0027_add_dataset_desc_limit'), + ] + + operations = [ + migrations.AlterModelOptions( + name='historicaldataset', + options={'get_latest_by': ('history_date', 'history_id'), 'ordering': ('-history_date', '-history_id'), 'verbose_name': 'historical data set', 'verbose_name_plural': 'historical data sets'}, + ), + migrations.AlterField( + model_name='historicaldataset', + name='history_date', + field=models.DateTimeField(db_index=True), + ), + ] diff --git a/archive_api/migrations/0029_alter_dataset_funding_organizations_and_more.py b/archive_api/migrations/0029_alter_dataset_funding_organizations_and_more.py new file mode 100644 index 00000000..9fe08488 --- /dev/null +++ b/archive_api/migrations/0029_alter_dataset_funding_organizations_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.2 on 2024-02-09 20:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive_api', '0028_alter_historicaldataset_options_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='dataset', + name='funding_organizations', + field=models.TextField(blank=True, max_length=1024, null=True), + ), + migrations.AlterField( + model_name='historicaldataset', + name='funding_organizations', + field=models.TextField(blank=True, max_length=1024, null=True), + ), + ] diff --git a/archive_api/models.py b/archive_api/models.py index 4a454300..ee9415b9 100644 --- a/archive_api/models.py +++ b/archive_api/models.py @@ -357,7 +357,7 @@ def data_set_id(self): qaqc_status = models.IntegerField(choices=QAQC_STATUS_CHOICES, blank=True, null=True) qaqc_method_description = models.TextField(blank=True, null=True) ngee_tropics_resources = models.BooleanField(blank=True, null=True) - funding_organizations = models.TextField(blank=True, null=True) + funding_organizations = models.TextField(blank=True, null=True, max_length=1024) doe_funding_contract_numbers = models.CharField(max_length=100, blank=True, null=True) acknowledgement = models.TextField(blank=True, null=True) reference = models.TextField(blank=True, null=True, max_length=2255) diff --git a/ui/static/js/app.js b/ui/static/js/app.js index 8c20768b..37f8597c 100644 --- a/ui/static/js/app.js +++ b/ui/static/js/app.js @@ -236,7 +236,7 @@ $(document).ready(function () { } }); - $.getJSON("static/js/metadata/dataset.json?v=20231026", function (data) { + $.getJSON("static/js/metadata/dataset.json?v=20240209", function (data) { templates.datasets = data; createEditForm('datasets'); }); diff --git a/ui/static/js/metadata/dataset.json b/ui/static/js/metadata/dataset.json index f06678f8..08ba88b9 100644 --- a/ui/static/js/metadata/dataset.json +++ b/ui/static/js/metadata/dataset.json @@ -161,7 +161,7 @@ "label": "Dataset Funding organization(s)", "sequence": 16, "multiple": false, - "description": "

Identify the agencies and offices that funded the work to generate the dataset. Separate multiple funders with a comma and a space.

" + "description": "

Identify the agencies and offices that funded the work to generate the dataset. Separate multiple funders with a comma and a space. This field has a limit of 1024 characters.

" }, "doe_funding_contract_numbers": { "type": "string",