From eb52a7a8c41d4a7237efbfac9346630cc0829e62 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Sun, 4 Aug 2024 23:59:35 -0300 Subject: [PATCH 01/15] Insere paramentro url nos metodos de classe de JournalLogo e adiciona campo url_logo --- journal/models.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/journal/models.py b/journal/models.py index 81fca3a5..e69d5509 100755 --- a/journal/models.py +++ b/journal/models.py @@ -2516,6 +2516,10 @@ class JournalLogo(CommonControlField): null=True, blank=True, ) + url_logo = models.URLField( + blank=True, + null=True, + ) class Meta: unique_together = [("journal", "logo")] @@ -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() @@ -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): From c56fba0c97c80a47d37e13771024a909c8cf343a Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 5 Aug 2024 00:02:43 -0300 Subject: [PATCH 02/15] Cria task para executar as logos --- journal/tasks.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/journal/tasks.py b/journal/tasks.py index f13e2f80..fea89842 100644 --- a/journal/tasks.py +++ b/journal/tasks.py @@ -127,7 +127,7 @@ def fetch_and_process_journal_logo( img_wagtail = Image(title=journal_acron) img_wagtail.file.save(f"{journal_acron}_glogo.gif", ContentFile(logo_data)) - journal_logo = JournalLogo.create_or_update(journal=journal, logo=img_wagtail, user=user) + journal_logo = JournalLogo.create_or_update(journal=journal, url=url_logo, logo=img_wagtail, user=user) journal.logo = journal_logo.logo journal.save() except Exception as e: @@ -142,3 +142,19 @@ def fetch_and_process_journal_logo( "domain": domain, }, ) + + +@celery_app.task(bind=True) +def fetch_and_process_journal_logos_in_collection(self, collection_acron3=None, user_id=None,username=None): + if collection_acron3: + collection = Collection.objects.get(acron3=collection_acron3) + journals = Journal.objects.filter(scielojournal__collection=collection) + else: + journals = Journal.objects.all() + + for journal in journals: + fetch_and_process_journal_logo( + journal_id=journal.id, + user_id=user_id, + username=username, + ) \ No newline at end of file From 48703eb7f3dc5c5b3ae7734ba36e07f2502f94e4 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 5 Aug 2024 00:02:54 -0300 Subject: [PATCH 03/15] Adiciona url_logo na api de journal --- journal/api/v1/serializers.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 4a08b4c9..e5edc6ec 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -79,6 +79,7 @@ class JournalSerializer(serializers.ModelSerializer): owner = OwnerSerializer(many=True, read_only=True, source="owner_history") acronym = serializers.SerializerMethodField() scielo_journal = serializers.SerializerMethodField() + url_logo = serializers.SerializerMethodField() def get_acronym(self, obj): scielo_journal = obj.scielojournal_set.first() @@ -106,6 +107,14 @@ def get_scielo_journal(self, obj): return journals + def get_url_logo(self, obj): + try: + return models.JournalLogo.objects.get(journal=obj).url_logo + + except models.JournalLogo.DoesNotExist: + return None + except models.JournalLogo.MultipleObjectsReturned: + return obj.title class Meta: model = models.Journal @@ -121,4 +130,5 @@ class Meta: "subject_descriptor", "subject", "text_language", + "url_logo", ] From a7430a0239f8be0177bc5f66ab44e0db5bf80cfa Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 5 Aug 2024 00:03:02 -0300 Subject: [PATCH 04/15] migracao --- .../migrations/0027_journallogo_url_logo.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 journal/migrations/0027_journallogo_url_logo.py diff --git a/journal/migrations/0027_journallogo_url_logo.py b/journal/migrations/0027_journallogo_url_logo.py new file mode 100644 index 00000000..d97374b6 --- /dev/null +++ b/journal/migrations/0027_journallogo_url_logo.py @@ -0,0 +1,18 @@ +# Generated by Django 5.0.3 on 2024-08-04 23:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("journal", "0026_editorialpolicy_opensciencecompliance"), + ] + + operations = [ + migrations.AddField( + model_name="journallogo", + name="url_logo", + field=models.URLField(blank=True, null=True), + ), + ] From 6c53d2c1dd1f93ac0473161e75b0f682d4921b0e Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Wed, 7 Aug 2024 16:11:29 -0300 Subject: [PATCH 05/15] Remove o campo url_logo --- .../migrations/0027_journallogo_url_logo.py | 18 ------------------ journal/models.py | 10 +--------- journal/tasks.py | 2 +- 3 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 journal/migrations/0027_journallogo_url_logo.py diff --git a/journal/migrations/0027_journallogo_url_logo.py b/journal/migrations/0027_journallogo_url_logo.py deleted file mode 100644 index d97374b6..00000000 --- a/journal/migrations/0027_journallogo_url_logo.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.3 on 2024-08-04 23:58 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ("journal", "0026_editorialpolicy_opensciencecompliance"), - ] - - operations = [ - migrations.AddField( - model_name="journallogo", - name="url_logo", - field=models.URLField(blank=True, null=True), - ), - ] diff --git a/journal/models.py b/journal/models.py index e69d5509..f9102348 100755 --- a/journal/models.py +++ b/journal/models.py @@ -2516,10 +2516,6 @@ class JournalLogo(CommonControlField): null=True, blank=True, ) - url_logo = models.URLField( - blank=True, - null=True, - ) class Meta: unique_together = [("journal", "logo")] @@ -2541,14 +2537,12 @@ def create( cls, journal, logo, - url, user, ): try: obj = cls( journal=journal, logo=logo, - url_logo=url, creator=user, ) obj.save() @@ -2561,16 +2555,14 @@ def create_or_update( cls, journal, logo, - url, user, ): try: obj = cls.get(journal=journal, logo=logo) - obj.url_logo = url obj.save() return obj except cls.DoesNotExist: - return cls.create(journal=journal, url=url, logo=logo, user=user) + return cls.create(journal=journal, logo=logo, user=user) class JournalOtherTitle(CommonControlField): diff --git a/journal/tasks.py b/journal/tasks.py index fea89842..f924d6f1 100644 --- a/journal/tasks.py +++ b/journal/tasks.py @@ -127,7 +127,7 @@ def fetch_and_process_journal_logo( img_wagtail = Image(title=journal_acron) img_wagtail.file.save(f"{journal_acron}_glogo.gif", ContentFile(logo_data)) - journal_logo = JournalLogo.create_or_update(journal=journal, url=url_logo, logo=img_wagtail, user=user) + journal_logo = JournalLogo.create_or_update(journal=journal, logo=img_wagtail, user=user) journal.logo = journal_logo.logo journal.save() except Exception as e: From e1946a8c67a44687eceea0b0f27efe8795feb160 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Wed, 7 Aug 2024 16:15:03 -0300 Subject: [PATCH 06/15] Altera o metodo get_url_logo para pegar o path da logo --- journal/api/v1/serializers.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 42eb98ee..770b1d8d 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -1,3 +1,4 @@ +from wagtail.models.sites import Site from rest_framework import serializers from core.api.v1.serializers import LanguageSerializer @@ -143,13 +144,12 @@ def get_scielo_journal(self, obj): return journals def get_url_logo(self, obj): - try: - return models.JournalLogo.objects.get(journal=obj).url_logo - - except models.JournalLogo.DoesNotExist: - return None - except models.JournalLogo.MultipleObjectsReturned: - return obj.title + if obj.logo: + domain = Site.objects.get(is_default_site=True).hostname + if not domain.startswith('https'): + domain = f"https://{domain}" + return f"{domain}{obj.logo.file.url}" + return None def get_email(self, obj): if obj.journal_email.all(): From 6c845c7c49606730f52a7e23704ed479bfc6f8fe Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 8 Aug 2024 14:47:34 -0300 Subject: [PATCH 07/15] Adiciona metodo __str__ em BaseHistoryItem --- institution/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/institution/models.py b/institution/models.py index fd335e24..82582844 100755 --- a/institution/models.py +++ b/institution/models.py @@ -432,6 +432,9 @@ def get_or_create(cls, institution, initial_date=None, final_date=None, user=Non class Meta: abstract = True + def __str__(self): + if self.institution.institution: + return self.institution.institution.institution_identification.name class BaseInstitution(CommonControlField): institution = models.ForeignKey( From 0172cb7f5a8b211d4652d80b6664c4c4e287f0a3 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 8 Aug 2024 14:48:16 -0300 Subject: [PATCH 08/15] - Adiciona os metodos get_next_journal_title e get_previous_journal_titles - Modifica os metodos de history --- journal/api/v1/serializers.py | 52 +++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 770b1d8d..5201536b 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -68,6 +68,7 @@ class Meta: class MissionSerializer(serializers.ModelSerializer): code2 = serializers.CharField(source="language.code2") + class Meta: model = models.Mission fields = [ @@ -91,31 +92,29 @@ class JournalSerializer(serializers.ModelSerializer): mission = MissionSerializer(many=True, read_only=True) issn_print = serializers.CharField(source="official.issn_print") issn_electronic = serializers.CharField(source="official.issn_electronic") - next_journal_title = serializers.CharField(source="official.next_journal_title") - previous_journal_titles = serializers.CharField(source="official.previous_journal_titles") other_titles = serializers.SerializerMethodField() sponsor = serializers.SerializerMethodField() email = serializers.SerializerMethodField() copyright = serializers.SerializerMethodField() + next_journal_title = serializers.SerializerMethodField() + previous_journal_titles = serializers.SerializerMethodField() - def get_institution_data(self, history): - data = [] - for record in history.all(): - if record.institution: - data.append({"name": record.institution.institution.institution_identification.name}) - return data if data else None def get_publisher(self, obj): - return self.get_institution_data(obj.publisher_history) + if queryset := obj.publisher_history.all(): + return [{"name": str(item)} for item in queryset] def get_owner(self, obj): - return self.get_institution_data(obj.owner_history) + if queryset := obj.owner_history.all(): + return [{"name": str(item)} for item in queryset] def get_sponsor(self, obj): - return self.get_institution_data(obj.sponsor_history) + if queryset := obj.sponsor_history.all(): + return [{"name": str(item)} for item in queryset] def get_copyright(self, obj): - return self.get_institution_data(obj.copyright_holder_history) + if queryset := obj.copyright_holder_history.all(): + return [{"name": str(item)} for item in queryset] def get_acronym(self, obj): scielo_journal = obj.scielojournal_set.first() @@ -146,8 +145,7 @@ def get_scielo_journal(self, obj): def get_url_logo(self, obj): if obj.logo: domain = Site.objects.get(is_default_site=True).hostname - if not domain.startswith('https'): - domain = f"https://{domain}" + domain = f"https://{domain}" return f"{domain}{obj.logo.file.url}" return None @@ -161,6 +159,32 @@ def get_other_titles(self, obj): return [other_title.title for other_title in obj.other_titles.all()] return None + def get_next_journal_title(self, obj): + if obj.official.next_journal_title: + return { + "next_journal_title": obj.official.next_journal_title, + "issn_print": obj.official.new_title.issn_print, + "issn_electronic": obj.official.new_title.issn_electronic, + } + + def get_previous_journal_titles(self, obj): + if obj.official.previous_journal_titles: + try: + old_issn_print = obj.official.old_title.get(title__icontains=obj.official.previous_journal_titles).issn_print + except models.OfficialJournal.DoesNotExist: + old_issn_print = None + + try: + old_issn_electronic = obj.official.old_title.get(title__icontains=obj.official.previous_journal_titles).issn_electronic + except models.OfficialJournal.DoesNotExist: + old_issn_electronic = None + + return { + "previous_journal_title": obj.official.previous_journal_titles, + "issn_print": old_issn_print, + "issn_electronic": old_issn_electronic, + } + class Meta: model = models.Journal From db68c001e84d39948cd019a7960fe100d27f5086 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Thu, 8 Aug 2024 14:49:07 -0300 Subject: [PATCH 09/15] Black --- journal/api/v1/serializers.py | 49 +++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 5201536b..05a0d600 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -68,7 +68,7 @@ class Meta: class MissionSerializer(serializers.ModelSerializer): code2 = serializers.CharField(source="language.code2") - + class Meta: model = models.Mission fields = [ @@ -99,7 +99,6 @@ class JournalSerializer(serializers.ModelSerializer): next_journal_title = serializers.SerializerMethodField() previous_journal_titles = serializers.SerializerMethodField() - def get_publisher(self, obj): if queryset := obj.publisher_history.all(): return [{"name": str(item)} for item in queryset] @@ -110,36 +109,39 @@ def get_owner(self, obj): def get_sponsor(self, obj): if queryset := obj.sponsor_history.all(): - return [{"name": str(item)} for item in queryset] + return [{"name": str(item)} for item in queryset] def get_copyright(self, obj): if queryset := obj.copyright_holder_history.all(): - return [{"name": str(item)} for item in queryset] + return [{"name": str(item)} for item in queryset] def get_acronym(self, obj): scielo_journal = obj.scielojournal_set.first() return scielo_journal.journal_acron if scielo_journal else None def get_scielo_journal(self, obj): - results = models.SciELOJournal.objects.filter(journal=obj).prefetch_related("journal_history") + results = models.SciELOJournal.objects.filter(journal=obj).prefetch_related( + "journal_history" + ) journals = [] for item in results: journal_dict = { - 'collection_acron': item.collection.acron3, - 'issn_scielo': item.issn_scielo, - 'journal_acron': item.journal_acron, - 'journal_history': [ + "collection_acron": item.collection.acron3, + "issn_scielo": item.issn_scielo, + "journal_acron": item.journal_acron, + "journal_history": [ { - 'day': history.day, - 'month': history.month, - 'year': history.year, - 'event_type': history.event_type, - 'interruption_reason': history.interruption_reason, - } for history in item.journal_history.all() + "day": history.day, + "month": history.month, + "year": history.year, + "event_type": history.event_type, + "interruption_reason": history.interruption_reason, + } + for history in item.journal_history.all() ], } journals.append(journal_dict) - + return journals def get_url_logo(self, obj): @@ -158,7 +160,7 @@ def get_other_titles(self, obj): if obj.other_titles.all(): return [other_title.title for other_title in obj.other_titles.all()] return None - + def get_next_journal_title(self, obj): if obj.official.next_journal_title: return { @@ -170,22 +172,25 @@ def get_next_journal_title(self, obj): def get_previous_journal_titles(self, obj): if obj.official.previous_journal_titles: try: - old_issn_print = obj.official.old_title.get(title__icontains=obj.official.previous_journal_titles).issn_print + old_issn_print = obj.official.old_title.get( + title__icontains=obj.official.previous_journal_titles + ).issn_print except models.OfficialJournal.DoesNotExist: old_issn_print = None try: - old_issn_electronic = obj.official.old_title.get(title__icontains=obj.official.previous_journal_titles).issn_electronic + old_issn_electronic = obj.official.old_title.get( + title__icontains=obj.official.previous_journal_titles + ).issn_electronic except models.OfficialJournal.DoesNotExist: - old_issn_electronic = None - + old_issn_electronic = None + return { "previous_journal_title": obj.official.previous_journal_titles, "issn_print": old_issn_print, "issn_electronic": old_issn_electronic, } - class Meta: model = models.Journal fields = [ From 69d2225b26a2266334ce33f1d7cc92453d01be51 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 12 Aug 2024 14:37:13 -0300 Subject: [PATCH 10/15] Em get_url_log muda protocolo para http --- journal/api/v1/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 05a0d600..1c90205b 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -147,7 +147,7 @@ def get_scielo_journal(self, obj): def get_url_logo(self, obj): if obj.logo: domain = Site.objects.get(is_default_site=True).hostname - domain = f"https://{domain}" + domain = f"http://{domain}" return f"{domain}{obj.logo.file.url}" return None From 42d275af64a33283c228540ac94197d2afc36eb0 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 12 Aug 2024 14:58:46 -0300 Subject: [PATCH 11/15] Altera BaseHistoryItem.__str__ --- institution/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/institution/models.py b/institution/models.py index 82582844..2d4c9e58 100755 --- a/institution/models.py +++ b/institution/models.py @@ -434,7 +434,7 @@ class Meta: def __str__(self): if self.institution.institution: - return self.institution.institution.institution_identification.name + return getattr(self.institution.institution.institution_identification, 'name', '') class BaseInstitution(CommonControlField): institution = models.ForeignKey( From cef5f757258ed26e7d3d51d52968df88d22854cf Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Mon, 12 Aug 2024 14:59:30 -0300 Subject: [PATCH 12/15] refactor get_next_journal_title e get_previous_journal_titles --- journal/api/v1/serializers.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index 1c90205b..fc21aee0 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -163,25 +163,25 @@ def get_other_titles(self, obj): def get_next_journal_title(self, obj): if obj.official.next_journal_title: + journal_new_title = obj.filter(title__icontains=obj.official.next_journal_title) return { "next_journal_title": obj.official.next_journal_title, - "issn_print": obj.official.new_title.issn_print, - "issn_electronic": obj.official.new_title.issn_electronic, + "issn_print": journal_new_title.official.issn_print, + "issn_electronic": journal_new_title.official.issn_electronic, } def get_previous_journal_titles(self, obj): if obj.official.previous_journal_titles: - try: - old_issn_print = obj.official.old_title.get( + old_journal = obj.official.old_title.get( title__icontains=obj.official.previous_journal_titles - ).issn_print + ) + try: + old_issn_print = old_journal.issn_print except models.OfficialJournal.DoesNotExist: old_issn_print = None try: - old_issn_electronic = obj.official.old_title.get( - title__icontains=obj.official.previous_journal_titles - ).issn_electronic + old_issn_electronic = old_journal.issn_electronic except models.OfficialJournal.DoesNotExist: old_issn_electronic = None From 6ba41ae4383468e4409de148c6a2a860b6cacddd Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Wed, 14 Aug 2024 14:58:21 -0300 Subject: [PATCH 13/15] Modifica BaseHistoryitem.__str__ --- institution/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/institution/models.py b/institution/models.py index 2d4c9e58..6ed91dad 100755 --- a/institution/models.py +++ b/institution/models.py @@ -433,8 +433,10 @@ class Meta: abstract = True def __str__(self): - if self.institution.institution: - return getattr(self.institution.institution.institution_identification, 'name', '') + try: + return self.institution.institution.institution_identification.name + except AttributeError: + return '' class BaseInstitution(CommonControlField): institution = models.ForeignKey( From 16f08f5f3995dedb795f73c0f3aa55069976010a Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Wed, 14 Aug 2024 20:15:27 -0300 Subject: [PATCH 14/15] Fix get_next_journal_title e get_previous_journal_title --- journal/api/v1/serializers.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/journal/api/v1/serializers.py b/journal/api/v1/serializers.py index fc21aee0..d3268dd2 100644 --- a/journal/api/v1/serializers.py +++ b/journal/api/v1/serializers.py @@ -97,7 +97,7 @@ class JournalSerializer(serializers.ModelSerializer): email = serializers.SerializerMethodField() copyright = serializers.SerializerMethodField() next_journal_title = serializers.SerializerMethodField() - previous_journal_titles = serializers.SerializerMethodField() + previous_journal_title = serializers.SerializerMethodField() def get_publisher(self, obj): if queryset := obj.publisher_history.all(): @@ -163,26 +163,29 @@ def get_other_titles(self, obj): def get_next_journal_title(self, obj): if obj.official.next_journal_title: - journal_new_title = obj.filter(title__icontains=obj.official.next_journal_title) + try: + journal_new_title = models.Journal.objects.get(title__icontains=obj.official.next_journal_title) + issn_print = journal_new_title.official.issn_print + issn_electronic = journal_new_title.official.issn_electronic + except models.Journal.DoesNotExist: + issn_print = None + issn_electronic = None return { "next_journal_title": obj.official.next_journal_title, - "issn_print": journal_new_title.official.issn_print, - "issn_electronic": journal_new_title.official.issn_electronic, + "issn_print": issn_print, + "issn_electronic": issn_electronic, } - def get_previous_journal_titles(self, obj): + def get_previous_journal_title(self, obj): if obj.official.previous_journal_titles: - old_journal = obj.official.old_title.get( + try: + old_journal = obj.official.old_title.get( title__icontains=obj.official.previous_journal_titles ) - try: old_issn_print = old_journal.issn_print - except models.OfficialJournal.DoesNotExist: - old_issn_print = None - - try: old_issn_electronic = old_journal.issn_electronic except models.OfficialJournal.DoesNotExist: + old_issn_print = None old_issn_electronic = None return { @@ -199,7 +202,7 @@ class Meta: "title", "short_title", "next_journal_title", - "previous_journal_titles", + "previous_journal_title", "other_titles", "acronym", "issn_print", From 7bb4e50f2270624fcabb94cd17fa18c68b7bb985 Mon Sep 17 00:00:00 2001 From: Samuel Veiga Rangel Date: Wed, 14 Aug 2024 20:16:57 -0300 Subject: [PATCH 15/15] Refactor panels BaseHistoryItem --- institution/models.py | 1 - journal/models.py | 14 +++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/institution/models.py b/institution/models.py index 6ed91dad..a1f195bd 100755 --- a/institution/models.py +++ b/institution/models.py @@ -387,7 +387,6 @@ class BaseHistoryItem(CommonControlField): final_date = models.DateField(_("Final Date"), null=True, blank=True) panels = [ - AutocompletePanel("institution"), FieldPanel("initial_date"), FieldPanel("final_date"), ] diff --git a/journal/models.py b/journal/models.py index f9102348..fbc56990 100755 --- a/journal/models.py +++ b/journal/models.py @@ -998,6 +998,9 @@ class OwnerHistory(Orderable, BaseHistoryItem): null=True, ) + panels = BaseHistoryItem.panels +[ + AutocompletePanel("institution") + ] class PublisherHistory(Orderable, BaseHistoryItem): journal = ParentalKey( @@ -1010,6 +1013,9 @@ class PublisherHistory(Orderable, BaseHistoryItem): null=True, ) + panels = BaseHistoryItem.panels +[ + AutocompletePanel("institution") + ] class SponsorHistory(Orderable, BaseHistoryItem): journal = ParentalKey( @@ -1022,6 +1028,9 @@ class SponsorHistory(Orderable, BaseHistoryItem): blank=True, ) + panels = BaseHistoryItem.panels +[ + AutocompletePanel("institution") + ] class CopyrightHolderHistory(Orderable, BaseHistoryItem): journal = ParentalKey( @@ -1036,7 +1045,10 @@ class CopyrightHolderHistory(Orderable, BaseHistoryItem): blank=True, null=True, ) - + + panels = BaseHistoryItem.panels +[ + AutocompletePanel("institution") + ] class JournalSocialNetwork(Orderable, SocialNetwork): page = ParentalKey(