Browse Source

Fix #27

pull/66/head
Sesostris Vieira 4 years ago
parent
commit
49a5ea262f
  1. 11
      sigi/apps/convenios/admin.py
  2. 40
      sigi/apps/convenios/migrations/0007_auto_20210416_0918.py
  3. 41
      sigi/apps/convenios/models.py
  4. 6
      sigi/apps/convenios/templates/convenios/change_list.html

11
sigi/apps/convenios/admin.py

@ -4,7 +4,8 @@ from django.http import HttpResponse, HttpResponseRedirect
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from geraldo.generators import PDFGenerator 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) EquipamentoPrevisto, Anexo, Tramitacao)
from sigi.apps.convenios.reports import ConvenioReport from sigi.apps.convenios.reports import ConvenioReport
from sigi.apps.convenios.views import adicionar_convenios_carrinho from sigi.apps.convenios.views import adicionar_convenios_carrinho
@ -46,10 +47,11 @@ class ConvenioAdmin(BaseModelAdmin):
fieldsets = ( fieldsets = (
(None, (None,
{'fields': ('casa_legislativa', 'num_processo_sf', 'num_convenio', {'fields': ('casa_legislativa', 'num_processo_sf', 'num_convenio',
'projeto', 'data_sigad', 'data_sigi',)} 'projeto', 'data_sigi',)}
), ),
(_(u"Acompanhamento no gabinete"), (_(u"Acompanhamento no gabinete"),
{'fields': ('status', 'acompanha', 'observacao',)} {'fields': ('data_solicitacao', 'data_sigad', 'tipo_solicitacao',
'status', 'acompanha', 'observacao',)}
), ),
(_(u'Datas'), (_(u'Datas'),
{'fields': ('data_retorno_assinatura', 'duracao', {'fields': ('data_retorno_assinatura', 'duracao',
@ -125,6 +127,8 @@ class ConvenioAdmin(BaseModelAdmin):
normaliza_data('data_sigad__lte') normaliza_data('data_sigad__lte')
normaliza_data('data_sigi__gte') normaliza_data('data_sigi__gte')
normaliza_data('data_sigi__lte') normaliza_data('data_sigi__lte')
normaliza_data('data_solicitacao__gte')
normaliza_data('data_solicitacao__lte')
request.GET._mutable = False request.GET._mutable = False
return super(ConvenioAdmin, self).changelist_view( return super(ConvenioAdmin, self).changelist_view(
@ -176,5 +180,6 @@ class EquipamentoPrevistoAdmin(BaseModelAdmin):
admin.site.register(Projeto) admin.site.register(Projeto)
admin.site.register(StatusConvenio) admin.site.register(StatusConvenio)
admin.site.register(TipoSolicitacao)
admin.site.register(Convenio, ConvenioAdmin) admin.site.register(Convenio, ConvenioAdmin)
admin.site.register(EquipamentoPrevisto, EquipamentoPrevistoAdmin) admin.site.register(EquipamentoPrevisto, EquipamentoPrevistoAdmin)

40
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,
),
]

41
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.utils import SearchField
from sigi.apps.servidores.models import Servidor from sigi.apps.servidores.models import Servidor
class Projeto(models.Model): class Projeto(models.Model):
""" Modelo para representar os projetos do programa """ Modelo para representar os projetos do programa
Interlegis Interlegis
""" """
@ -30,6 +28,17 @@ class StatusConvenio(models.Model):
def __unicode__(self): def __unicode__(self):
return self.nome 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): class Convenio(models.Model):
""" Modelo que representa um convênio do Interlegis """ Modelo que representa um convênio do Interlegis
@ -63,23 +72,35 @@ class Convenio(models.Model):
max_length=10, max_length=10,
blank=True blank=True
) )
status = models.ForeignKey( data_sigi = models.DateField(
StatusConvenio, _(u"data de cadastro no SIGI"),
on_delete=models.SET_NULL, blank=True,
verbose_name=_(u"estado atual"),
null=True, null=True,
blank=True auto_now_add=True
) )
data_sigad = models.DateField( data_sigad = models.DateField(
_(u"data de cadastro no SIGAD"), _(u"data de cadastro no SIGAD"),
null=True, null=True,
blank=True blank=True
) )
data_sigi = models.DateField( data_solicitacao = models.DateField(
_(u"data de cadastro no SIGI"), _(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, 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, null=True,
auto_now_add=True blank=True
) )
acompanha = models.ForeignKey( acompanha = models.ForeignKey(
Servidor, Servidor,

6
sigi/apps/convenios/templates/convenios/change_list.html

@ -34,6 +34,12 @@
<label for="data_sigi__lte">{% trans 'até' %}:</label> <label for="data_sigi__lte">{% trans 'até' %}:</label>
<input type="text" class="form-control search-query" size="10" name="data_sigi__lte" value="" id="data_sigi__lte"> <input type="text" class="form-control search-query" size="10" name="data_sigi__lte" value="" id="data_sigi__lte">
</div> </div>
<div class="form-group">
<label for="data_solicitacao__gte">{% trans 'E-mail a partir de' %}:</label>
<input type="text" class="form-control search-query" size="10" name="data_solicitacao__gte" value="" id="data_solicitacao__gte">
<label for="data_solicitacao__lte">{% trans 'até' %}:</label>
<input type="text" class="form-control search-query" size="10" name="data_solicitacao__lte" value="" id="data_solicitacao__lte">
</div>
<button type="submit" class="btn btn-default navbar-btn "> <button type="submit" class="btn btn-default navbar-btn ">
<span class="glyphicon glyphicon-search"></span> <span class="glyphicon glyphicon-search"></span>
</button> </button>

Loading…
Cancel
Save