From c2f4b850dd1043a0ce6a705dff0bcd79a8705a1e Mon Sep 17 00:00:00 2001 From: GitInno <86991526+gitnnolabs@users.noreply.github.com> Date: Thu, 29 Aug 2024 08:38:36 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Adiciona=20um=20ano=20aleat=C3=B3rio=20para?= =?UTF-8?q?=20os=20reposit=C3=B3rios.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- education_directory/search_indexes.py | 5 +++++ event_directory/search_indexes.py | 4 ++++ infrastructure_directory/search_indexes.py | 5 +++++ policy_directory/search_indexes.py | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/education_directory/search_indexes.py b/education_directory/search_indexes.py index ce426d24..8ef8c8c5 100644 --- a/education_directory/search_indexes.py +++ b/education_directory/search_indexes.py @@ -1,8 +1,10 @@ # coding: utf-8 +import random from haystack import indexes from django.conf import settings from django.utils.translation import gettext as _ + from education_directory import models @@ -59,6 +61,9 @@ def prepare_year(self, obj): if obj.end_date: return obj.end_date.year + + if not obj.end_date and not obj.start_date: + return random.randint(2014, 2023) def prepare_created(self, obj): return obj.created.isoformat() diff --git a/event_directory/search_indexes.py b/event_directory/search_indexes.py index e4d27fe1..b7fe2e22 100644 --- a/event_directory/search_indexes.py +++ b/event_directory/search_indexes.py @@ -1,4 +1,5 @@ # coding: utf-8 +import random from haystack import indexes from django.conf import settings from django.utils.translation import gettext as _ @@ -60,6 +61,9 @@ def prepare_year(self, obj): if obj.end_date: return obj.end_date.year + + if not obj.end_date and not obj.start_date: + return random.randint(2014, 2023) def prepare_created(self, obj): return obj.created.isoformat() diff --git a/infrastructure_directory/search_indexes.py b/infrastructure_directory/search_indexes.py index 123cd15f..ffa73088 100644 --- a/infrastructure_directory/search_indexes.py +++ b/infrastructure_directory/search_indexes.py @@ -1,4 +1,5 @@ # coding: utf-8 +import random from haystack import indexes from django.conf import settings from django.utils.translation import gettext as _ @@ -29,6 +30,7 @@ class InfraStructureIndex(indexes.SearchIndex, indexes.Indexable): states = indexes.MultiValueField(null=True) regions = indexes.MultiValueField(null=True) thematic_level_0 = indexes.MultiValueField(null=True) + year = indexes.CharField(null=True) text = indexes.CharField(document=True, use_template=True) title = indexes.CharField(model_attr="title", null=True) @@ -55,6 +57,9 @@ class InfraStructureIndex(indexes.SearchIndex, indexes.Indexable): creator = indexes.CharField(null=False) updated_by = indexes.CharField(null=False) + def prepare_year(self, obj): + return random.randint(2014, 2023) + def prepare_created(self, obj): return obj.created.isoformat() diff --git a/policy_directory/search_indexes.py b/policy_directory/search_indexes.py index 71139e4f..fedbcd6d 100644 --- a/policy_directory/search_indexes.py +++ b/policy_directory/search_indexes.py @@ -1,4 +1,5 @@ # coding: utf-8 +import random from haystack import indexes from django.conf import settings from django.utils.translation import gettext as _ @@ -51,6 +52,9 @@ class PolicyIndex(indexes.SearchIndex, indexes.Indexable): def prepare_year(self, obj): if obj.date: return obj.date.year + else: + return random.randint(2014, 2023) + def prepare_created(self, obj): return obj.created.isoformat() From 694752216fde5b7f4d6fb6731642b749039a1875 Mon Sep 17 00:00:00 2001 From: GitInno <86991526+gitnnolabs@users.noreply.github.com> Date: Thu, 29 Aug 2024 08:40:58 -0300 Subject: [PATCH 2/2] =?UTF-8?q?Adiciona=20mais=20uma=20op=C3=A7=C3=A3o=20n?= =?UTF-8?q?a=20lista=20de=20universo=20e=20na=20lista=20de=20objetos.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- search/templates/graph/graph.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/search/templates/graph/graph.html b/search/templates/graph/graph.html index 78cbe7cd..02eaee56 100644 --- a/search/templates/graph/graph.html +++ b/search/templates/graph/graph.html @@ -92,6 +92,7 @@