From b7001b3823918c5824168f19cead2ec687021d6c Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Tue, 16 Nov 2021 11:41:15 -0300 Subject: [PATCH 1/5] Alterando o submenu de Visitas --- sigi/apps/convenios/models.py | 10 +++++++++- sigi/apps/home/templatetags/menu_conf.yaml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index 5ab575e..636d237 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -10,7 +10,6 @@ from django.utils.translation import ugettext as _ from sigi.apps.utils import SearchField, to_ascii from sigi.apps.casas.models import Orgao from sigi.apps.servidores.models import Servidor, Servico -#from sigi.apps.convenios.admin import ConvenioAdmin class Projeto(models.Model): """ Modelo para representar os projetos do programa @@ -66,6 +65,7 @@ class Convenio(models.Model): blank=True, help_text=_(u'Formatos:
Antigo: XXXXXX/XX-X.
SIGAD: XXXXX.XXXXXX/XXXX-XX') ) + link_processo_stf = ('get_sigad_url') num_convenio = models.CharField( _(u'número do convênio'), max_length=10, @@ -212,6 +212,14 @@ class Convenio(models.Model): return _(u"Indefinido") + def link_sigad(self, obj): + if obj.pk is None: + return "" + return obj.get_sigad_url() + + link_sigad.short_description = _("Processo no Senado") + link_sigad.allow_tags = True + def get_sigad_url(self): m = re.match( r'(?P00100|00200)\.(?P\d{6})/(?P\d{4})-\d{2}', diff --git a/sigi/apps/home/templatetags/menu_conf.yaml b/sigi/apps/home/templatetags/menu_conf.yaml index 5be956b..8ef31b9 100644 --- a/sigi/apps/home/templatetags/menu_conf.yaml +++ b/sigi/apps/home/templatetags/menu_conf.yaml @@ -50,7 +50,7 @@ main_menu: - title: Oficinas url: eventos/evento/?tipo_evento__nome__contains=Oficina - title: Visitas Interlegis - url: eventos/evento/?tipo_evento__nome__exact=Visita Interlegis + url: eventos/evento/?tipo_evento__nome__contains=Visita - title: Calendário mensal url: eventos/calendario - title: Alocação de equipe From de27ee206f168cf9d7e60eaef20cec1f1cb5daef Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Thu, 18 Nov 2021 10:30:29 -0300 Subject: [PATCH 2/5] Fix #105 --- sigi/apps/convenios/reports.py | 40 +++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/sigi/apps/convenios/reports.py b/sigi/apps/convenios/reports.py index 0cb0474..f873f2e 100644 --- a/sigi/apps/convenios/reports.py +++ b/sigi/apps/convenios/reports.py @@ -52,6 +52,12 @@ class ConvenioReport(ReportDefault): top=label_top, width=2 * cm, ), + Label( + text=_(u"Projeto"), + left=label_left[5] * cm, + top=label_top + 0.4 * cm, + width=2 * cm, + ), Label( text=_(u"Data do Convênio"), left=label_left[3] * cm, @@ -64,12 +70,6 @@ class ConvenioReport(ReportDefault): top=label_top, width=2 * cm, ), - Label( - text=_(u"Projeto"), - left=label_left[5] * cm, - top=label_top + 0.4 * cm, - width=2 * cm, - ), Label( text=_(u"Orgão"), left=label_left[6] * cm, @@ -98,6 +98,10 @@ class ConvenioReport(ReportDefault): attribute_name='num_convenio', left=label_left[2] * cm ), + ObjectValue( + attribute_name='projeto.sigla', + left=label_left[5] * cm + ), ObjectValue( attribute_name='data_retorno_assinatura', left=label_left[3] * cm, @@ -110,10 +114,6 @@ class ConvenioReport(ReportDefault): get_value=lambda instance: instance.data_pub_diario.strftime('%d/%m/%Y') if instance.data_pub_diario is not None else '-' ), - ObjectValue( - attribute_name='projeto.sigla', - left=label_left[5] * cm - ), ObjectValue( attribute_name='casa_legislativa.nome', left=label_left[6] * cm @@ -160,12 +160,6 @@ class ConvenioReportSemAceite(ConvenioReport): left=label_left[2] * cm, top=label_top, width=2 * cm, - ), - Label( - text=_(u"Data do Convênio"), - left=label_left[3] * cm, - top=label_top, - width=2 * cm, ), Label( text=_(u"Projeto"), @@ -173,6 +167,12 @@ class ConvenioReportSemAceite(ConvenioReport): top=label_top, width=2 * cm, ), + Label( + text=_(u"Data do Convênio"), + left=label_left[3] * cm, + top=label_top, + width=2 * cm, + ), Label( text=_(u"Orgão"), left=label_left[5] * cm, @@ -198,16 +198,16 @@ class ConvenioReportSemAceite(ConvenioReport): attribute_name='num_convenio', left=label_left[2] * cm ), + ObjectValue( + attribute_name='projeto.sigla', + left=label_left[4], + ), ObjectValue( attribute_name='data_retorno_assinatura', left=label_left[3] * cm, get_value=lambda instance: instance.data_retorno_assinatura.strftime('%d/%m/%Y') if instance.data_retorno_assinatura is not None else '-' ), - ObjectValue( - attribute_name='projeto.sigla', - left=label_left[4], - ), ObjectValue( attribute_name='casa_legislativa.nome', left=label_left[5] * cm From 0682c015e664882111345083ad6f3284e1a452f0 Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Thu, 18 Nov 2021 11:03:49 -0300 Subject: [PATCH 3/5] Fix #99 --- sigi/apps/casas/views.py | 5 ++++- sigi/apps/convenios/views.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sigi/apps/casas/views.py b/sigi/apps/casas/views.py index 8aa29d4..741786d 100644 --- a/sigi/apps/casas/views.py +++ b/sigi/apps/casas/views.py @@ -2,6 +2,8 @@ import csv from datetime import datetime from functools import reduce + +from django.contrib import messages from sigi.apps.utils import to_ascii from geraldo.generators import PDFGenerator @@ -446,7 +448,8 @@ def visualizar_carrinho(request): def excluir_carrinho(request): if 'carrinho_casas' in request.session: del request.session['carrinho_casas'] - return HttpResponseRedirect('.') + messages.info(request, u'O carrinho foi esvaziado') + return HttpResponseRedirect('../../') @login_required diff --git a/sigi/apps/convenios/views.py b/sigi/apps/convenios/views.py index dd21f0e..e829d09 100644 --- a/sigi/apps/convenios/views.py +++ b/sigi/apps/convenios/views.py @@ -2,6 +2,7 @@ import csv import datetime +from django.contrib import messages from django.http.response import HttpResponseForbidden import ho.pisa as pisa from django.conf import settings @@ -114,7 +115,8 @@ def adicionar_convenios_carrinho(request, queryset=None, id=None): def excluir_carrinho(request): if 'carrinho_convenios' in request.session: del request.session['carrinho_convenios'] - return HttpResponseRedirect('.') + messages.info(request, u'O carrinho foi esvaziado') + return HttpResponseRedirect('../../') @login_required def deleta_itens_carrinho(request): From c652a2b2f77d0a529db4ace2686726900265a7d6 Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Thu, 18 Nov 2021 12:16:23 -0300 Subject: [PATCH 4/5] Update models.py --- sigi/apps/convenios/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index 636d237..adb5021 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -59,7 +59,7 @@ class Convenio(models.Model): on_delete=models.PROTECT, ) # numero designado pelo Senado Federal para o convênio - num_processo_sf = models.CharField( + # num_processo_sf = models.CharField( _(u'número do processo SF (Senado Federal)'), max_length=20, blank=True, From 0272d492540fc46b8a3341e09082c9e17bb22eab Mon Sep 17 00:00:00 2001 From: Lude Ribeiro Date: Thu, 18 Nov 2021 12:17:09 -0300 Subject: [PATCH 5/5] Update models.py --- sigi/apps/convenios/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index adb5021..cabc724 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -59,13 +59,13 @@ class Convenio(models.Model): on_delete=models.PROTECT, ) # numero designado pelo Senado Federal para o convênio - # num_processo_sf = models.CharField( + num_processo_sf = models.CharField( _(u'número do processo SF (Senado Federal)'), max_length=20, blank=True, help_text=_(u'Formatos:
Antigo: XXXXXX/XX-X.
SIGAD: XXXXX.XXXXXX/XXXX-XX') ) - link_processo_stf = ('get_sigad_url') + # link_processo_stf = ('get_sigad_url') num_convenio = models.CharField( _(u'número do convênio'), max_length=10,