From 103c41d394e7a29423894d90be71b2c8e729c80b Mon Sep 17 00:00:00 2001 From: isabelmeister Date: Wed, 13 Nov 2024 00:39:16 -0300 Subject: [PATCH 1/4] fix: create migration to add new url field in dataset --- .../0051_add_dataset_new_urlfield.py | 13 ++++++++++++ .../0051_add_textfield_all_models.py | 21 ------------------- 2 files changed, 13 insertions(+), 21 deletions(-) create mode 100644 backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py delete mode 100644 backend/apps/api/v1/migrations/0051_add_textfield_all_models.py diff --git a/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py b/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py new file mode 100644 index 00000000..c8113fc0 --- /dev/null +++ b/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py @@ -0,0 +1,13 @@ +# Generated by Django 4.2.16 on 2024-11-13 01:13 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('v1', '0050_table_is_deprecated'), + ] + + operations = [ + ] diff --git a/backend/apps/api/v1/migrations/0051_add_textfield_all_models.py b/backend/apps/api/v1/migrations/0051_add_textfield_all_models.py deleted file mode 100644 index 68484ac9..00000000 --- a/backend/apps/api/v1/migrations/0051_add_textfield_all_models.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 4.2.16 on 2024-11-12 15:34 - -from django.db import migrations, models - -def add_new_field_to_all_tables(apps, schema_editor): - for model in apps.get_models(): - schema_editor.add_field( - model, - name='url_links', - field=models.TextField(max_length=255, default='', blank=True) - ) - -class Migration(migrations.Migration): - - dependencies = [ - ('v1', '0050_table_is_deprecated'), - ] - - operations = [ - migrations.RunPython(add_new_field_to_all_tables), - ] From 9e6ec9784767fac94f62f019e497cf8eb98ae894 Mon Sep 17 00:00:00 2001 From: isabelmeister Date: Wed, 13 Nov 2024 00:41:07 -0300 Subject: [PATCH 2/4] feat: add new url field to dataset --- .../api/v1/migrations/0051_add_dataset_new_urlfield.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py b/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py index c8113fc0..e303c87b 100644 --- a/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py +++ b/backend/apps/api/v1/migrations/0051_add_dataset_new_urlfield.py @@ -1,6 +1,6 @@ # Generated by Django 4.2.16 on 2024-11-13 01:13 -from django.db import migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -10,4 +10,9 @@ class Migration(migrations.Migration): ] operations = [ + migrations.AddField( + model_name='dataset', + name='link_url', + field=models.URLField(blank=True, null=True, verbose_name='Link') + ), ] From 6d9da9d8c3a9a8f0860e26c238c37f8b63ada237 Mon Sep 17 00:00:00 2001 From: isabelmeister Date: Wed, 13 Nov 2024 00:41:46 -0300 Subject: [PATCH 3/4] feat: display url field in dataset django --- backend/apps/api/v1/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/apps/api/v1/models.py b/backend/apps/api/v1/models.py index c3233ddf..d62f045e 100644 --- a/backend/apps/api/v1/models.py +++ b/backend/apps/api/v1/models.py @@ -545,6 +545,7 @@ class Dataset(BaseModel): default=0, help_text="Number of page views by Google Analytics", ) + link_url = models.URLField(blank=True, null=True) graphql_nested_filter_fields_whitelist = ["id", "slug"] From 47b815f8e08fb213f83fe163d8f922106a68c922 Mon Sep 17 00:00:00 2001 From: isabelmeister Date: Wed, 13 Nov 2024 00:45:13 -0300 Subject: [PATCH 4/4] fix(Model): add verbose_name in new urlField --- backend/apps/api/v1/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/api/v1/models.py b/backend/apps/api/v1/models.py index d62f045e..2ab0d83b 100644 --- a/backend/apps/api/v1/models.py +++ b/backend/apps/api/v1/models.py @@ -545,7 +545,7 @@ class Dataset(BaseModel): default=0, help_text="Number of page views by Google Analytics", ) - link_url = models.URLField(blank=True, null=True) + link_url = models.URLField(blank=True, null=True, verbose_name='Link') graphql_nested_filter_fields_whitelist = ["id", "slug"]