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

Cria Processamento Para Logos dos Periódicos e Adiciona o campo url_logo na API de Journal #838

Merged
merged 16 commits into from
Sep 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions journal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2516,6 +2516,10 @@ class JournalLogo(CommonControlField):
null=True,
blank=True,
)
url_logo = models.URLField(
Copy link
Member

Choose a reason for hiding this comment

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

@samuelveigarangel no lugar de criar um novo campo, vc poderia usar o link para a imagem (campo logo, linha 2512)

blank=True,
null=True,
)

class Meta:
unique_together = [("journal", "logo")]
Expand All @@ -2537,12 +2541,14 @@ def create(
cls,
journal,
logo,
url,
user,
):
try:
obj = cls(
journal=journal,
logo=logo,
url_logo=url,
creator=user,
)
obj.save()
Expand All @@ -2555,12 +2561,16 @@ def create_or_update(
cls,
journal,
logo,
url,
user,
):
try:
return cls.get(journal=journal, logo=logo)
obj = cls.get(journal=journal, logo=logo)
obj.url_logo = url
obj.save()
return obj
except cls.DoesNotExist:
return cls.create(journal=journal, logo=logo, user=user)
return cls.create(journal=journal, url=url, logo=logo, user=user)


class JournalOtherTitle(CommonControlField):
Expand Down