Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disponibiliza o campo doi_prefix na API Journal #830

Merged
merged 11 commits into from
Oct 1, 2024
13 changes: 6 additions & 7 deletions article/api/v1/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(doi__value__startswith=doi_prefix)
return queryset
1 change: 1 addition & 0 deletions journal/api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class Meta:
"email",
"contact_address",
"text_language",
"doi_prefix",
"mission",
"sponsor",
"copyright",
Expand Down
18 changes: 18 additions & 0 deletions journal/migrations/0027_journal_doi_prefix.py
Original file line number Diff line number Diff line change
@@ -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=100, null=True),
Copy link
Member

@robertatakenaka robertatakenaka Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel O meu comentário anterior diz que 50 para doi_prefix é muito, então 100, é demais. Tinha adicionado a documentação. Segue a imagem. Sugiro no máximo 20 e no mínimo 15

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entendi seu comentário de forma errada e pensei que era para aumentar o tamanho. Pesquisei sobre o limite do tamanho do DOI e a única fonte que encontrei relacionada a isso foi: https://www.doi.org/resources/DOI_article_ELIS3.pdf. Na seção 'syntax', é informado que não há um limite definido para o tamanho do DOI, prefixo ou sufixo.

),
]
1 change: 1 addition & 0 deletions journal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ class Journal(CommonControlField, ClusterableModel):
blank=True,
verbose_name=_("DigitalPreservationAgency"),
)
doi_prefix = models.CharField(max_length=100, blank=True, null=True)
valid = models.BooleanField(default=False, null=True, blank=True)

autocomplete_search_field = "title"
Expand Down
Loading