From 49a5ea262ffdc9d494bbb4ce28e003d906577085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ses=C3=B3stris=20Vieira?= Date: Fri, 16 Apr 2021 12:51:01 -0300 Subject: [PATCH] Fix #27 --- sigi/apps/convenios/admin.py | 11 +++-- .../migrations/0007_auto_20210416_0918.py | 40 ++++++++++++++++++ sigi/apps/convenios/models.py | 41 ++++++++++++++----- .../templates/convenios/change_list.html | 6 +++ 4 files changed, 85 insertions(+), 13 deletions(-) create mode 100644 sigi/apps/convenios/migrations/0007_auto_20210416_0918.py diff --git a/sigi/apps/convenios/admin.py b/sigi/apps/convenios/admin.py index 4f46529..b55fd90 100644 --- a/sigi/apps/convenios/admin.py +++ b/sigi/apps/convenios/admin.py @@ -4,7 +4,8 @@ from django.http import HttpResponse, HttpResponseRedirect from django.utils.translation import ugettext as _ from geraldo.generators import PDFGenerator -from sigi.apps.convenios.models import (Projeto, StatusConvenio, Convenio, +from sigi.apps.convenios.models import (Projeto, StatusConvenio, + TipoSolicitacao, Convenio, EquipamentoPrevisto, Anexo, Tramitacao) from sigi.apps.convenios.reports import ConvenioReport from sigi.apps.convenios.views import adicionar_convenios_carrinho @@ -46,10 +47,11 @@ class ConvenioAdmin(BaseModelAdmin): fieldsets = ( (None, {'fields': ('casa_legislativa', 'num_processo_sf', 'num_convenio', - 'projeto', 'data_sigad', 'data_sigi',)} + 'projeto', 'data_sigi',)} ), (_(u"Acompanhamento no gabinete"), - {'fields': ('status', 'acompanha', 'observacao',)} + {'fields': ('data_solicitacao', 'data_sigad', 'tipo_solicitacao', + 'status', 'acompanha', 'observacao',)} ), (_(u'Datas'), {'fields': ('data_retorno_assinatura', 'duracao', @@ -125,6 +127,8 @@ class ConvenioAdmin(BaseModelAdmin): normaliza_data('data_sigad__lte') normaliza_data('data_sigi__gte') normaliza_data('data_sigi__lte') + normaliza_data('data_solicitacao__gte') + normaliza_data('data_solicitacao__lte') request.GET._mutable = False return super(ConvenioAdmin, self).changelist_view( @@ -176,5 +180,6 @@ class EquipamentoPrevistoAdmin(BaseModelAdmin): admin.site.register(Projeto) admin.site.register(StatusConvenio) +admin.site.register(TipoSolicitacao) admin.site.register(Convenio, ConvenioAdmin) admin.site.register(EquipamentoPrevisto, EquipamentoPrevistoAdmin) diff --git a/sigi/apps/convenios/migrations/0007_auto_20210416_0918.py b/sigi/apps/convenios/migrations/0007_auto_20210416_0918.py new file mode 100644 index 0000000..0daaf23 --- /dev/null +++ b/sigi/apps/convenios/migrations/0007_auto_20210416_0918.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('convenios', '0006_auto_20210416_0841'), + ] + + operations = [ + migrations.CreateModel( + name='TipoSolicitacao', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('nome', models.CharField(max_length=100)), + ], + options={ + 'ordering': ('nome',), + 'verbose_name': 'tipo de solicita\xe7\xe3o', + 'verbose_name_plural': 'Tipos de solicita\xe7\xe3o', + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='convenio', + name='data_solicitacao', + field=models.DateField(null=True, verbose_name='data do e-mail de solicita\xe7\xe3o', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='convenio', + name='tipo_solicitacao', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, verbose_name='tipo de solicita\xe7\xe3o', blank=True, to='convenios.TipoSolicitacao', null=True), + preserve_default=True, + ), + ] diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index 2d5e998..e7bfa9c 100644 --- a/sigi/apps/convenios/models.py +++ b/sigi/apps/convenios/models.py @@ -6,9 +6,7 @@ from django.utils.translation import ugettext as _ from sigi.apps.utils import SearchField from sigi.apps.servidores.models import Servidor - class Projeto(models.Model): - """ Modelo para representar os projetos do programa Interlegis """ @@ -30,6 +28,17 @@ class StatusConvenio(models.Model): def __unicode__(self): return self.nome +class TipoSolicitacao(models.Model): + nome = models.CharField(max_length=100) + + class Meta: + ordering = ('nome',) + verbose_name = _(u"tipo de solicitação") + verbose_name_plural = _(u"Tipos de solicitação") + + def __unicode__(self): + return self.nome + class Convenio(models.Model): """ Modelo que representa um convênio do Interlegis @@ -63,23 +72,35 @@ class Convenio(models.Model): max_length=10, blank=True ) - status = models.ForeignKey( - StatusConvenio, - on_delete=models.SET_NULL, - verbose_name=_(u"estado atual"), + data_sigi = models.DateField( + _(u"data de cadastro no SIGI"), + blank=True, null=True, - blank=True + auto_now_add=True ) data_sigad = models.DateField( _(u"data de cadastro no SIGAD"), null=True, blank=True ) - data_sigi = models.DateField( - _(u"data de cadastro no SIGI"), + data_solicitacao = models.DateField( + _(u"data do e-mail de solicitação"), + null=True, + blank=True + ) + tipo_solicitacao = models.ForeignKey( + TipoSolicitacao, + on_delete=models.PROTECT, + null=True, blank=True, + verbose_name=_(u"tipo de solicitação") + ) + status = models.ForeignKey( + StatusConvenio, + on_delete=models.SET_NULL, + verbose_name=_(u"estado atual"), null=True, - auto_now_add=True + blank=True ) acompanha = models.ForeignKey( Servidor, diff --git a/sigi/apps/convenios/templates/convenios/change_list.html b/sigi/apps/convenios/templates/convenios/change_list.html index ccb9607..f9aae7b 100644 --- a/sigi/apps/convenios/templates/convenios/change_list.html +++ b/sigi/apps/convenios/templates/convenios/change_list.html @@ -34,6 +34,12 @@ +
+ + + + +