From 3f16b24b9046426ddc9d36ef5a2701b7fd3b87f4 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 1 Aug 2024 03:05:01 -0300 Subject: [PATCH 1/8] Adiciona campo doi_prefix no modelo Journal --- journal/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/journal/models.py b/journal/models.py index 81fca3a5..463c3d55 100755 --- a/journal/models.py +++ b/journal/models.py @@ -570,6 +570,7 @@ class Journal(CommonControlField, ClusterableModel): blank=True, verbose_name=_("DigitalPreservationAgency"), ) + doi_prefix = models.CharField(max_length=50, blank=True, null=True) valid = models.BooleanField(default=False, null=True, blank=True) autocomplete_search_field = "title" From 64228951f0dade67f235f35141b4fd71a3edcb2c Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 1 Aug 2024 03:07:55 -0300 Subject: [PATCH 2/8] Disponibiliza na API o campo doi_prefix --- journal/api/v1/serializers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 4a08b4c9..cb0eac8a 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -121,4 +121,5 @@ class Meta: "subject_descriptor", "subject", "text_language", + "doi_prefix", ] From 03c0c8da625e4d444803fc2abfa0840b2d1601f9 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 1 Aug 2024 03:08:01 -0300 Subject: [PATCH 3/8] migracao --- journal/migrations/0027_journal_doi_prefix.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 journal/migrations/0027_journal_doi_prefix.py diff --git a/journal/migrations/0027_journal_doi_prefix.py b/journal/migrations/0027_journal_doi_prefix.py new file mode 100644 index 00000000..f2b24071 --- /dev/null +++ b/journal/migrations/0027_journal_doi_prefix.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.3 on 2024-08-01 06:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("journal", "0026_editorialpolicy_opensciencecompliance"), + ] + + operations = [ + migrations.AddField( + model_name="journal", + name="doi_prefix", + field=models.CharField(blank=True, max_length=50, null=True), + ), + ] From 0dd56686aeb0e93fb8abdecb72a93b1886d5161b Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 1 Aug 2024 03:14:47 -0300 Subject: [PATCH 4/8] =?UTF-8?q?Adiciona=20get=5Fqueryset=20para=20filtrar?= =?UTF-8?q?=20pelo=20doi=5Fprefix=20que=20os=20peri=C3=B3dicos=20est=C3=A3?= =?UTF-8?q?o=20registrados.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- article/api/v1/views.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/article/api/v1/views.py b/article/api/v1/views.py index d1bc886a..10e20cbc 100644 --- a/article/api/v1/views.py +++ b/article/api/v1/views.py @@ -10,10 +10,9 @@ class ArticleViewSet(viewsets.ModelViewSet): http_method_names = ["get"] queryset = models.Article.objects.all() - # def get_queryset(self): - # """ - # This view should return a list of all published Education. - # """ - # # user = self.request.user - - # return models.Article.objects.all() + def get_queryset(self): + queryset = models.Article.objects.all() + doi_prefix = self.request.query_params.get('doi_prefix', None) + if doi_prefix is not None: + queryset = queryset.filter(journal__doi_prefix=doi_prefix) + return queryset \ No newline at end of file From 076e1dfc385b2f41af3fd8fd30eaa6ff56beaafa Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 12 Aug 2024 21:00:44 -0300 Subject: [PATCH 5/8] Altera queryset --- article/api/v1/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/article/api/v1/views.py b/article/api/v1/views.py index 10e20cbc..db2ca39c 100644 --- a/article/api/v1/views.py +++ b/article/api/v1/views.py @@ -14,5 +14,5 @@ def get_queryset(self): queryset = models.Article.objects.all() doi_prefix = self.request.query_params.get('doi_prefix', None) if doi_prefix is not None: - queryset = queryset.filter(journal__doi_prefix=doi_prefix) + queryset = queryset.filter(doi__value__startswith=doi_prefix) return queryset \ No newline at end of file From 12008f181820e4948fef913d3c0a02cf312dc98c Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 12 Aug 2024 21:01:12 -0300 Subject: [PATCH 6/8] Altera max_length de doi_prefix --- journal/migrations/0027_journal_doi_prefix.py | 2 +- journal/models.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/journal/migrations/0027_journal_doi_prefix.py b/journal/migrations/0027_journal_doi_prefix.py index f2b24071..b86621a9 100644 --- a/journal/migrations/0027_journal_doi_prefix.py +++ b/journal/migrations/0027_journal_doi_prefix.py @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="journal", name="doi_prefix", - field=models.CharField(blank=True, max_length=50, null=True), + field=models.CharField(blank=True, max_length=100, null=True), ), ] diff --git a/journal/models.py b/journal/models.py index 463c3d55..7306031e 100755 --- a/journal/models.py +++ b/journal/models.py @@ -570,7 +570,7 @@ class Journal(CommonControlField, ClusterableModel): blank=True, verbose_name=_("DigitalPreservationAgency"), ) - doi_prefix = models.CharField(max_length=50, blank=True, null=True) + doi_prefix = models.CharField(max_length=100, blank=True, null=True) valid = models.BooleanField(default=False, null=True, blank=True) autocomplete_search_field = "title" From a60cc399fa8ac80b84559a8bf29cfbf4a0b1ce27 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Wed, 14 Aug 2024 22:09:32 -0300 Subject: [PATCH 7/8] Altera tamanho para 20 --- journal/migrations/0027_journal_doi_prefix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/journal/migrations/0027_journal_doi_prefix.py b/journal/migrations/0027_journal_doi_prefix.py index b86621a9..36128b0f 100644 --- a/journal/migrations/0027_journal_doi_prefix.py +++ b/journal/migrations/0027_journal_doi_prefix.py @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name="journal", name="doi_prefix", - field=models.CharField(blank=True, max_length=100, null=True), + field=models.CharField(blank=True, max_length=20, null=True), ), ] From 89fb3c431f4137c2087a99533f42195c38c968ec Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 15 Aug 2024 01:28:01 -0300 Subject: [PATCH 8/8] altera max_legth de doi_prefix para 20 --- journal/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/journal/models.py b/journal/models.py index 7306031e..a0de6d92 100755 --- a/journal/models.py +++ b/journal/models.py @@ -570,7 +570,7 @@ class Journal(CommonControlField, ClusterableModel): blank=True, verbose_name=_("DigitalPreservationAgency"), ) - doi_prefix = models.CharField(max_length=100, blank=True, null=True) + doi_prefix = models.CharField(max_length=20, blank=True, null=True) valid = models.BooleanField(default=False, null=True, blank=True) autocomplete_search_field = "title"