Browse Source

Ajuste de formatação para aderência à PEP8

pull/166/head 3.0.46
Sesóstris Vieira 1 year ago
parent
commit
9b24780fe8
  1. 44
      conftest.py
  2. 4
      manage.py
  3. 57
      scripts/casas_com_PM_e_SAPL.py
  4. 34
      scripts/casas_que_usam_LEGBR_ou_PM.py
  5. 70
      scripts/contatos_de_casas_que_usam_portalmodelo.py
  6. 10
      scripts/csv_writer.py
  7. 15
      scripts/urls de portais modelo por estado municipio.py
  8. 2
      setup.py
  9. 5
      sigi/apps/casas/admin.py
  10. 4
      sigi/apps/casas/jobs/daily/usuario_contato.py
  11. 1
      sigi/apps/casas/migrations/0001_initial.py
  12. 1
      sigi/apps/casas/migrations/0002_auto_20150710_1247.py
  13. 1
      sigi/apps/casas/migrations/0003_auto_20200207_0919.py
  14. 1
      sigi/apps/casas/migrations/0004_auto_20201015_0810.py
  15. 1
      sigi/apps/casas/migrations/0005_casalegislativa_gerentes_interlegis.py
  16. 1
      sigi/apps/casas/migrations/0006_remove_casalegislativa_gerente_contas.py
  17. 5
      sigi/apps/casas/migrations/0007_auto_20201016_1632.py
  18. 1
      sigi/apps/casas/migrations/0008_auto_20210218_1007.py
  19. 1
      sigi/apps/casas/migrations/0009_auto_20210406_1055.py
  20. 1
      sigi/apps/casas/migrations/0010_auto_20210406_1101.py
  21. 1
      sigi/apps/casas/migrations/0011_auto_20210406_1135.py
  22. 1
      sigi/apps/casas/migrations/0012_auto_20210406_1420.py
  23. 1
      sigi/apps/casas/migrations/0013_auto_20210406_1428.py
  24. 1
      sigi/apps/casas/migrations/0014_auto_20210406_1945.py
  25. 1
      sigi/apps/casas/migrations/0015_auto_20210407_0801.py
  26. 1
      sigi/apps/casas/migrations/0016_auto_20210407_1559.py
  27. 1
      sigi/apps/casas/migrations/0017_auto_20210416_0841.py
  28. 1
      sigi/apps/casas/migrations/0018_orgao_sigla.py
  29. 1
      sigi/apps/casas/migrations/0019_auto_20210501_1058.py
  30. 1
      sigi/apps/casas/migrations/0020_auto_20210611_0946.py
  31. 9
      sigi/apps/casas/migrations/0021_alter_orgao_options_remove_orgao_recorte_and_more.py
  32. 24
      sigi/apps/casas/migrations/0022_orgao_brasao_orgao_brasao_altura_and_more.py
  33. 22
      sigi/apps/casas/migrations/0023_funcionario_cpf_funcionario_identidade.py
  34. 5
      sigi/apps/casas/migrations/0024_delete_presidente.py
  35. 15
      sigi/apps/casas/migrations/0025_orgao_telefone_geral.py
  36. 1
      sigi/apps/casas/migrations/0026_carga_telefone_geral.py
  37. 5
      sigi/apps/casas/migrations/0027_alter_orgao_email.py
  38. 4
      sigi/apps/casas/models.py
  39. 5
      sigi/apps/casas/views.py
  40. 8
      sigi/apps/contatos/jobs/monthly/atualiza_ibge.py
  41. 9
      sigi/apps/contatos/migrations/0001_initial.py
  42. 1
      sigi/apps/contatos/migrations/0002_auto_20151104_0810.py
  43. 1
      sigi/apps/contatos/migrations/0003_auto_20210416_0841.py
  44. 1
      sigi/apps/contatos/migrations/0004_auto_20210611_0946.py
  45. 1
      sigi/apps/contatos/migrations/0005_alter_mesorregiao_options_alter_microrregiao_options_and_more.py
  46. 1
      sigi/apps/contatos/migrations/0006_alter_unidadefederativa_regiao.py
  47. 4
      sigi/apps/contatos/models.py
  48. 8
      sigi/apps/convenios/filters.py
  49. 4
      sigi/apps/convenios/migrations/0001_initial.py
  50. 1
      sigi/apps/convenios/migrations/0002_convenio_duracao.py
  51. 1
      sigi/apps/convenios/migrations/0003_auto_20210406_1945.py
  52. 1
      sigi/apps/convenios/migrations/0004_auto_20210407_1928.py
  53. 1
      sigi/apps/convenios/migrations/0005_auto_20210409_0842.py
  54. 1
      sigi/apps/convenios/migrations/0006_auto_20210416_0841.py
  55. 1
      sigi/apps/convenios/migrations/0007_auto_20210416_0918.py
  56. 1
      sigi/apps/convenios/migrations/0008_auto_20210422_1907.py
  57. 1
      sigi/apps/convenios/migrations/0009_auto_20210611_0946.py
  58. 1
      sigi/apps/convenios/migrations/0010_auto_20210819_0833.py
  59. 1
      sigi/apps/convenios/migrations/0011_convenio_data_termino_vigencia.py
  60. 1
      sigi/apps/convenios/migrations/0012_auto_20210831_0844.py
  61. 1
      sigi/apps/convenios/migrations/0013_remove_convenio_duracao.py
  62. 1
      sigi/apps/convenios/migrations/0014_gescon.py
  63. 1
      sigi/apps/convenios/migrations/0015_remove_convenio_search_text.py
  64. 1
      sigi/apps/convenios/migrations/0016_auto_20210909_0732.py
  65. 1
      sigi/apps/convenios/migrations/0017_convenio_id_contrato_gescon.py
  66. 1
      sigi/apps/convenios/migrations/0018_auto_20211208_1256.py
  67. 6
      sigi/apps/convenios/migrations/0019_alter_anexo_arquivo_alter_anexo_descricao_and_more.py
  68. 1
      sigi/apps/convenios/migrations/0020_gescon_orgaos_gestores.py
  69. 23
      sigi/apps/convenios/migrations/0021_projeto_texto_minuta_projeto_texto_oficio.py
  70. 19
      sigi/apps/convenios/migrations/0022_remove_projeto_texto_minuta_projeto_modelo_minuta.py
  71. 30
      sigi/apps/convenios/migrations/0023_alter_projeto_modelo_minuta_and_more.py
  72. 12
      sigi/apps/convenios/migrations/0024_alter_anexo_data_pub.py
  73. 27
      sigi/apps/convenios/migrations/0025_alter_projeto_modelo_minuta_and_more.py
  74. 27
      sigi/apps/convenios/migrations/0026_alter_projeto_modelo_minuta_and_more.py
  75. 27
      sigi/apps/convenios/migrations/0027_alter_projeto_modelo_minuta_and_more.py
  76. 27
      sigi/apps/convenios/migrations/0028_alter_projeto_modelo_minuta_and_more.py
  77. 27
      sigi/apps/convenios/migrations/0029_alter_projeto_modelo_minuta_and_more.py
  78. 27
      sigi/apps/convenios/migrations/0030_alter_projeto_modelo_minuta_and_more.py
  79. 27
      sigi/apps/convenios/migrations/0031_alter_projeto_modelo_minuta_and_more.py
  80. 1
      sigi/apps/convenios/migrations/0032_gescon_palavras_excluir.py
  81. 5
      sigi/apps/convenios/migrations/0033_alter_projeto_modelo_minuta_and_more.py
  82. 12
      sigi/apps/convenios/models.py
  83. 8
      sigi/apps/convenios/views.py
  84. 4
      sigi/apps/diagnosticos/admin.py
  85. 9
      sigi/apps/diagnosticos/forms.py
  86. 3
      sigi/apps/diagnosticos/management/commands/ls_export.py
  87. 5
      sigi/apps/diagnosticos/migrations/0001_initial.py
  88. 1
      sigi/apps/diagnosticos/migrations/0002_auto_20160719_0920.py
  89. 1
      sigi/apps/diagnosticos/migrations/0002_auto_20170407_1024.py
  90. 1
      sigi/apps/diagnosticos/migrations/0003_auto_20201101_2240.py
  91. 1
      sigi/apps/diagnosticos/migrations/0004_auto_20210406_1945.py
  92. 1
      sigi/apps/diagnosticos/migrations/0005_auto_20210416_0841.py
  93. 1
      sigi/apps/diagnosticos/migrations/0006_merge.py
  94. 9
      sigi/apps/diagnosticos/views.py
  95. 4
      sigi/apps/diagnosticos/widgets.py
  96. 34
      sigi/apps/eventos/admin.py
  97. 6
      sigi/apps/eventos/migrations/0001_initial.py
  98. 1
      sigi/apps/eventos/migrations/0002_auto_20151016_1449.py
  99. 1
      sigi/apps/eventos/migrations/0003_auto_20151104_0810.py
  100. 1
      sigi/apps/eventos/migrations/0004_auto_20160719_0920.py

44
conftest.py

@ -7,25 +7,45 @@ DEFAULT_MARK = object()
class SigiTestApp(DjangoTestApp):
def __init__(self, extra_environ=None, relative_to=None, default_user=None):
def __init__(
self, extra_environ=None, relative_to=None, default_user=None
):
super(SigiTestApp, self).__init__(extra_environ, relative_to)
self.default_user = default_user
def get(self, url, params=None, headers=None, extra_environ=None,
status=None, expect_errors=False, user=DEFAULT_MARK, auto_follow=True,
content_type=None, **kwargs):
# note we altered the default values for user and auto_follow
def get(
self,
url,
params=None,
headers=None,
extra_environ=None,
status=None,
expect_errors=False,
user=DEFAULT_MARK,
auto_follow=True,
content_type=None,
**kwargs
):
# note we altered the default values for user and auto_follow
if user is DEFAULT_MARK: # a trick to allow explicit user=None
user = self.default_user
return super(SigiTestApp, self).get(url, params, headers, extra_environ,
status, expect_errors, user, auto_follow,
content_type, **kwargs)
@pytest.fixture(scope='function')
return super(SigiTestApp, self).get(
url,
params,
headers,
extra_environ,
status,
expect_errors,
user,
auto_follow,
content_type,
**kwargs
)
@pytest.fixture(scope="function")
def app(request, admin_user):
"""WebTest's TestApp.

4
manage.py

@ -6,7 +6,7 @@ import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sigi.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sigi.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv)
if __name__ == '__main__':
if __name__ == "__main__":
main()

57
scripts/casas_com_PM_e_SAPL.py

@ -2,33 +2,58 @@ from csv_writer import CsvWriter
from sigi.apps.servicos.models import Servico
ARQUIVO_CSV = '/tmp/casas_que_usam_PM_e_SAPL.csv'
ARQUIVO_CSV = "/tmp/casas_que_usam_PM_e_SAPL.csv"
def escrever_casas(casas, arquivo):
with open(arquivo, "wb") as f:
writer = CsvWriter(f)
writer.writerow([
"casa: sigla UF", "casa: nome UF", "casa: NOME",
])
writer.writerow(
[
"casa: sigla UF",
"casa: nome UF",
"casa: NOME",
]
)
for casa in casas:
writer.writerow([
casa.municipio.uf.sigla, casa.municipio.uf, casa.nome,
])
casas_pm = {s.casa_legislativa for s in Servico.objects.filter(tipo_servico__sigla='PM', data_desativacao__isnull=True)}
casas_sapl = {s.casa_legislativa for s in Servico.objects.filter(tipo_servico__sigla='SAPL', data_desativacao__isnull=True)}
writer.writerow(
[
casa.municipio.uf.sigla,
casa.municipio.uf,
casa.nome,
]
)
casas_pm = {
s.casa_legislativa
for s in Servico.objects.filter(
tipo_servico__sigla="PM", data_desativacao__isnull=True
)
}
casas_sapl = {
s.casa_legislativa
for s in Servico.objects.filter(
tipo_servico__sigla="SAPL", data_desativacao__isnull=True
)
}
casas_ativas = casas_pm & casas_sapl
escrever_casas(casas_ativas, '/tmp/casas_que_usam_PM_e_SAPL__AMBOS_ATIVOS.csv')
casas_pm = {s.casa_legislativa for s in Servico.objects.filter(tipo_servico__sigla='PM')}
casas_sapl = {s.casa_legislativa for s in Servico.objects.filter(tipo_servico__sigla='SAPL')}
escrever_casas(casas_ativas, "/tmp/casas_que_usam_PM_e_SAPL__AMBOS_ATIVOS.csv")
casas_pm = {
s.casa_legislativa
for s in Servico.objects.filter(tipo_servico__sigla="PM")
}
casas_sapl = {
s.casa_legislativa
for s in Servico.objects.filter(tipo_servico__sigla="SAPL")
}
casas_todas = casas_pm & casas_sapl
escrever_casas(casas_todas, '/tmp/casas_que_usam_PM_e_SAPL__TODOS.csv')
escrever_casas(casas_todas, "/tmp/casas_que_usam_PM_e_SAPL__TODOS.csv")
casas = casas_pm.union(casas_sapl)
escrever_casas(casas, '/tmp/casas_que_usam_PM_ou_SAPL.csv')
escrever_casas(casas, "/tmp/casas_que_usam_PM_ou_SAPL.csv")
casas_algum_inativo = casas_todas

34
scripts/casas_que_usam_LEGBR_ou_PM.py

@ -11,7 +11,7 @@ from sigi.apps.servicos.models import TipoServico, Servico
# %run scripts/contatos_de_casas_que_usam_portalmodelo.py
# ... verificar <ARQUIVO_CSV>
ARQUIVO_CSV = '/tmp/casas_que_usam_LEGBR_ou_PM.csv'
ARQUIVO_CSV = "/tmp/casas_que_usam_LEGBR_ou_PM.csv"
class UnicodeWriter:
@ -31,7 +31,7 @@ class UnicodeWriter:
self.encoder = codecs.getincrementalencoder(encoding)()
def clean(self, cell):
return unicode(cell) if cell else '-'
return unicode(cell) if cell else "-"
def writerow(self, row):
self.writer.writerow([self.clean(s).encode("utf-8") for s in row])
@ -50,18 +50,28 @@ class UnicodeWriter:
self.writerow(row)
pm = TipoServico.objects.get(sigla=u'PM')
leg = TipoServico.objects.get(sigla=u'LEGBR')
servicos = Servico.objects.filter(tipo_servico__in=[pm, leg], data_desativacao__isnull=True)
pm = TipoServico.objects.get(sigla="PM")
leg = TipoServico.objects.get(sigla="LEGBR")
servicos = Servico.objects.filter(
tipo_servico__in=[pm, leg], data_desativacao__isnull=True
)
casas = {s.casa_legislativa for s in servicos}
with open(ARQUIVO_CSV, "wb") as f:
writer = UnicodeWriter(f, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
writer.writerow([
"casa: UF", "casa: NOME",
])
writer = UnicodeWriter(
f, delimiter="\t", quotechar='"', quoting=csv.QUOTE_ALL
)
writer.writerow(
[
"casa: UF",
"casa: NOME",
]
)
for casa in casas:
writer.writerow([
casa.municipio.uf, casa.nome,
])
writer.writerow(
[
casa.municipio.uf,
casa.nome,
]
)

70
scripts/contatos_de_casas_que_usam_portalmodelo.py

@ -12,7 +12,7 @@ from sigi.apps.servicos.models import TipoServico, Servico
# %run scripts/contatos_de_casas_que_usam_portalmodelo.py
# ... verificar <ARQUIVO_CSV>
ARQUIVO_CSV = '/tmp/contatos_casas_pm.csv'
ARQUIVO_CSV = "/tmp/contatos_casas_pm.csv"
class UnicodeWriter:
@ -32,7 +32,7 @@ class UnicodeWriter:
self.encoder = codecs.getincrementalencoder(encoding)()
def clean(self, cell):
return unicode(cell) if cell else '-'
return unicode(cell) if cell else "-"
def writerow(self, row):
self.writer.writerow([self.clean(s).encode("utf-8") for s in row])
@ -51,33 +51,61 @@ class UnicodeWriter:
self.writerow(row)
pm = TipoServico.objects.get(nome=u'Portal Modelo')
servicos = Servico.objects.filter(tipo_servico=pm, data_desativacao__isnull=True)
pm = TipoServico.objects.get(nome="Portal Modelo")
servicos = Servico.objects.filter(
tipo_servico=pm, data_desativacao__isnull=True
)
casas = {s.casa_legislativa for s in servicos}
tipos_telefone = dict(Telefone.TELEFONE_CHOICES)
setores_funcionarios = dict(Funcionario.SETOR_CHOICES)
with open(ARQUIVO_CSV, "wb") as f:
writer = UnicodeWriter(f, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
writer.writerow([
"casa: ID", "casa: NOME",
"contato: NOME", "contato: TIPO",
"contato: EMAIL", "contato: CARGO", "contato: FUNCAO", "contato: TELEFONES",
])
writer = UnicodeWriter(
f, delimiter="\t", quotechar='"', quoting=csv.QUOTE_ALL
)
writer.writerow(
[
"casa: ID",
"casa: NOME",
"contato: NOME",
"contato: TIPO",
"contato: EMAIL",
"contato: CARGO",
"contato: FUNCAO",
"contato: TELEFONES",
]
)
for casa in casas:
contatos = casa.funcionario_set.filter(setor__in=["contato_interlegis", "estrutura_de_ti"])
contatos = casa.funcionario_set.filter(
setor__in=["contato_interlegis", "estrutura_de_ti"]
)
if not contatos:
contatos = casa.funcionario_set.all()
for contato in contatos:
writer.writerow([
casa.pk, casa.nome,
contato.nome, setores_funcionarios.get(contato.setor, '?').decode('utf-8'),
contato.email, contato.cargo, contato.funcao,
'; '.join('%s [tipo: %s]' % (t.numero, tipos_telefone.get(t.tipo)) for t in contato.telefones.all()),
])
writer.writerow(
[
casa.pk,
casa.nome,
contato.nome,
setores_funcionarios.get(contato.setor, "?").decode(
"utf-8"
),
contato.email,
contato.cargo,
contato.funcao,
"; ".join(
"%s [tipo: %s]"
% (t.numero, tipos_telefone.get(t.tipo))
for t in contato.telefones.all()
),
]
)
if not contatos:
writer.writerow([
casa.pk, casa.nome,
'SEM CONTATOS CADASTRADOS',
])
writer.writerow(
[
casa.pk,
casa.nome,
"SEM CONTATOS CADASTRADOS",
]
)

10
scripts/csv_writer.py

@ -15,12 +15,18 @@ class CsvWriter:
def __init__(self, f, dialect=csv.excel, encoding="utf-8"):
# Redirect output to a queue
self.queue = cStringIO.StringIO()
self.writer = csv.writer(self.queue, dialect=dialect, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)
self.writer = csv.writer(
self.queue,
dialect=dialect,
delimiter="\t",
quotechar='"',
quoting=csv.QUOTE_ALL,
)
self.stream = f
self.encoder = codecs.getincrementalencoder(encoding)()
def clean(self, cell):
return unicode(cell) if cell else '-'
return unicode(cell) if cell else "-"
def writerow(self, row):
self.writer.writerow([self.clean(s).encode("utf-8") for s in row])

15
scripts/urls de portais modelo por estado municipio.py

@ -1,8 +1,17 @@
from sigi.apps.servicos.models import TipoServico
pm = TipoServico.objects.first()
res = sorted([(p.casa_legislativa.municipio.uf, p.casa_legislativa.municipio.nome, p.url) for p in pm.servico_set.all()])
res = sorted(
[
(
p.casa_legislativa.municipio.uf,
p.casa_legislativa.municipio.nome,
p.url,
)
for p in pm.servico_set.all()
]
)
with open('/tmp/pm.csv', 'w+') as f:
with open("/tmp/pm.csv", "w+") as f:
for uf, cid, url in res:
f.write(('%s,%s,%s' % (uf.nome, cid, url) + '\n').encode('utf-8'))
f.write(("%s,%s,%s" % (uf.nome, cid, url) + "\n").encode("utf-8"))

2
setup.py

@ -5,4 +5,4 @@
from distutils.core import setup
setup(name='sigi', version='3.x')
setup(name="sigi", version="3.x")

5
sigi/apps/casas/admin.py

@ -298,7 +298,10 @@ class FuncionarioAdmin(ReturnMixin, admin.ModelAdmin):
(None, {"fields": ("nome", "sexo", "data_nascimento")}),
(_("Documentos"), {"fields": ("cpf", "identidade")}),
(_("Contato"), {"fields": ("nota", "email", "redes_sociais")}),
(_("Endereço"), {"fields": ("endereco", "municipio", "bairro", "cep")}),
(
_("Endereço"),
{"fields": ("endereco", "municipio", "bairro", "cep")},
),
(
_("Vínculo"),
{

4
sigi/apps/casas/jobs/daily/usuario_contato.py

@ -39,7 +39,9 @@ class Job(JobReportMixin, DailyJob):
)
if created:
tot_news += 1
self.admin_log_addition(user, "Novo contato técnico habilitado")
self.admin_log_addition(
user, "Novo contato técnico habilitado"
)
else:
tot_updates += 1
self.admin_log_change(user, "Contato técnico atualizado")

1
sigi/apps/casas/migrations/0001_initial.py

@ -5,7 +5,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("servidores", "0001_initial"),
("contatos", "0001_initial"),

1
sigi/apps/casas/migrations/0002_auto_20150710_1247.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("servidores", "0001_initial"),
("casas", "0001_initial"),

1
sigi/apps/casas/migrations/0003_auto_20200207_0919.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0002_auto_20150710_1247"),
]

1
sigi/apps/casas/migrations/0004_auto_20201015_0810.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0003_auto_20200207_0919"),
]

1
sigi/apps/casas/migrations/0005_casalegislativa_gerentes_interlegis.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("servidores", "0001_initial"),
("casas", "0004_auto_20201015_0810"),

1
sigi/apps/casas/migrations/0006_remove_casalegislativa_gerente_contas.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0005_casalegislativa_gerentes_interlegis"),
]

5
sigi/apps/casas/migrations/0007_auto_20201016_1632.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0006_remove_casalegislativa_gerente_contas"),
]
@ -13,7 +12,9 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="funcionario",
name="desativado",
field=models.BooleanField(default=False, verbose_name="Desativado"),
field=models.BooleanField(
default=False, verbose_name="Desativado"
),
preserve_default=True,
),
migrations.AddField(

1
sigi/apps/casas/migrations/0008_auto_20210218_1007.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("contatos", "0002_auto_20151104_0810"),
("casas", "0007_auto_20201016_1632"),

1
sigi/apps/casas/migrations/0009_auto_20210406_1055.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0008_auto_20210218_1007"),
]

1
sigi/apps/casas/migrations/0010_auto_20210406_1101.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0009_auto_20210406_1055"),
]

1
sigi/apps/casas/migrations/0011_auto_20210406_1135.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0010_auto_20210406_1101"),
]

1
sigi/apps/casas/migrations/0012_auto_20210406_1420.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0011_auto_20210406_1135"),
]

1
sigi/apps/casas/migrations/0013_auto_20210406_1428.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0012_auto_20210406_1420"),
]

1
sigi/apps/casas/migrations/0014_auto_20210406_1945.py

@ -5,7 +5,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("contatos", "0002_auto_20151104_0810"),
("servidores", "0001_initial"),

1
sigi/apps/casas/migrations/0015_auto_20210407_0801.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0014_auto_20210406_1945"),
]

1
sigi/apps/casas/migrations/0016_auto_20210407_1559.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0015_auto_20210407_0801"),
]

1
sigi/apps/casas/migrations/0017_auto_20210416_0841.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("casas", "0016_auto_20210407_1559"),
]

1
sigi/apps/casas/migrations/0018_orgao_sigla.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0017_auto_20210416_0841"),
]

1
sigi/apps/casas/migrations/0019_auto_20210501_1058.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0018_orgao_sigla"),
]

1
sigi/apps/casas/migrations/0020_auto_20210611_0946.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("casas", "0019_auto_20210501_1058"),
]

9
sigi/apps/casas/migrations/0021_alter_orgao_options_remove_orgao_recorte_and_more.py

@ -6,7 +6,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("servidores", "0008_alter_servico_id_alter_servidor_foto_and_more"),
(
@ -53,7 +52,9 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="funcionario",
name="desativado",
field=models.BooleanField(default=False, verbose_name="desativado"),
field=models.BooleanField(
default=False, verbose_name="desativado"
),
),
migrations.AlterField(
model_name="funcionario",
@ -86,7 +87,9 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="funcionario",
name="nome",
field=models.CharField(max_length=60, verbose_name="nome completo"),
field=models.CharField(
max_length=60, verbose_name="nome completo"
),
),
migrations.AlterField(
model_name="funcionario",

24
sigi/apps/casas/migrations/0022_orgao_brasao_orgao_brasao_altura_and_more.py

@ -4,25 +4,31 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('casas', '0021_alter_orgao_options_remove_orgao_recorte_and_more'),
("casas", "0021_alter_orgao_options_remove_orgao_recorte_and_more"),
]
operations = [
migrations.AddField(
model_name='orgao',
name='brasao',
field=models.ImageField(blank=True, height_field='brasao_altura', help_text='Trate a imagem para que ela fique com cerca de 120x120 pixels', upload_to='imagens/casas/brasao', verbose_name='brasão', width_field='brasao_largura'),
model_name="orgao",
name="brasao",
field=models.ImageField(
blank=True,
height_field="brasao_altura",
help_text="Trate a imagem para que ela fique com cerca de 120x120 pixels",
upload_to="imagens/casas/brasao",
verbose_name="brasão",
width_field="brasao_largura",
),
),
migrations.AddField(
model_name='orgao',
name='brasao_altura',
model_name="orgao",
name="brasao_altura",
field=models.SmallIntegerField(editable=False, null=True),
),
migrations.AddField(
model_name='orgao',
name='brasao_largura',
model_name="orgao",
name="brasao_largura",
field=models.SmallIntegerField(editable=False, null=True),
),
]

22
sigi/apps/casas/migrations/0023_funcionario_cpf_funcionario_identidade.py

@ -4,20 +4,26 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('casas', '0022_orgao_brasao_orgao_brasao_altura_and_more'),
("casas", "0022_orgao_brasao_orgao_brasao_altura_and_more"),
]
operations = [
migrations.AddField(
model_name='funcionario',
name='cpf',
field=models.CharField(blank=True, max_length=20, verbose_name='CPF'),
model_name="funcionario",
name="cpf",
field=models.CharField(
blank=True, max_length=20, verbose_name="CPF"
),
),
migrations.AddField(
model_name='funcionario',
name='identidade',
field=models.CharField(blank=True, help_text='Informe o RG e o órgão emissor.', max_length=30, verbose_name='Identidade (RG)'),
model_name="funcionario",
name="identidade",
field=models.CharField(
blank=True,
help_text="Informe o RG e o órgão emissor.",
max_length=30,
verbose_name="Identidade (RG)",
),
),
]

5
sigi/apps/casas/migrations/0024_delete_presidente.py

@ -4,13 +4,12 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('casas', '0023_funcionario_cpf_funcionario_identidade'),
("casas", "0023_funcionario_cpf_funcionario_identidade"),
]
operations = [
migrations.DeleteModel(
name='Presidente',
name="Presidente",
),
]

15
sigi/apps/casas/migrations/0025_orgao_telefone_geral.py

@ -4,15 +4,20 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('casas', '0024_delete_presidente'),
("casas", "0024_delete_presidente"),
]
operations = [
migrations.AddField(
model_name='orgao',
name='telefone_geral',
field=models.CharField(blank=True, default='', help_text='Exemplo: <em>(31)8851-9898</em>.', max_length=64, verbose_name='telefone geral'),
model_name="orgao",
name="telefone_geral",
field=models.CharField(
blank=True,
default="",
help_text="Exemplo: <em>(31)8851-9898</em>.",
max_length=64,
verbose_name="telefone geral",
),
),
]

1
sigi/apps/casas/migrations/0026_carga_telefone_geral.py

@ -19,7 +19,6 @@ def carrega_telefone_geral(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
("casas", "0025_orgao_telefone_geral"),
]

5
sigi/apps/casas/migrations/0027_alter_orgao_email.py

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("casas", "0026_carga_telefone_geral"),
]
@ -13,6 +12,8 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="orgao",
name="email",
field=models.EmailField(blank=True, max_length=128, verbose_name="email"),
field=models.EmailField(
blank=True, max_length=128, verbose_name="email"
),
),
]

4
sigi/apps/casas/models.py

@ -96,7 +96,9 @@ class Orgao(models.Model):
null=True,
blank=True,
)
obs_pesquisa = models.TextField(_("observações do pesquisador"), blank=True)
obs_pesquisa = models.TextField(
_("observações do pesquisador"), blank=True
)
ult_alt_endereco = models.DateTimeField(
_("última alteração do endereço"), null=True, blank=True, editable=True
)

5
sigi/apps/casas/views.py

@ -88,7 +88,10 @@ def resumo_carteira(casas):
else:
dados_ocorrencia["registradas"][regiao] += quantidade
dados_ocorrencia["registradas"]["total"] += quantidade
if status in [Ocorrencia.STATUS_ABERTO, Ocorrencia.STATUS_REABERTO]:
if status in [
Ocorrencia.STATUS_ABERTO,
Ocorrencia.STATUS_REABERTO,
]:
dados_ocorrencia["pendentes"][regiao] += quantidade
dados_ocorrencia["pendentes"]["total"] += quantidade

8
sigi/apps/contatos/jobs/monthly/atualiza_ibge.py

@ -48,7 +48,13 @@ class Job(JobReportMixin, MonthlyJob):
}
def atualiza_ufs(self):
regioes_map = {"N": "NO", "NE": "NE", "SE": "SE", "S": "SL", "CO": "CO"}
regioes_map = {
"N": "NO",
"NE": "NE",
"SE": "SE",
"S": "SL",
"CO": "CO",
}
for ibge_uf in Estados().json():
regiao = regioes_map[ibge_uf["regiao"]["sigla"]]

9
sigi/apps/contatos/migrations/0001_initial.py

@ -6,7 +6,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("contenttypes", "0001_initial"),
]
@ -198,7 +197,9 @@ class Migration(migrations.Migration):
),
(
"populacao",
models.PositiveIntegerField(verbose_name="popula\xe7\xe3o"),
models.PositiveIntegerField(
verbose_name="popula\xe7\xe3o"
),
),
(
"is_polo",
@ -386,7 +387,9 @@ class Migration(migrations.Migration):
),
(
"populacao",
models.PositiveIntegerField(verbose_name="popula\xe7\xe3o"),
models.PositiveIntegerField(
verbose_name="popula\xe7\xe3o"
),
),
],
options={

1
sigi/apps/contatos/migrations/0002_auto_20151104_0810.py

@ -6,7 +6,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("contatos", "0001_initial"),
]

1
sigi/apps/contatos/migrations/0003_auto_20210416_0841.py

@ -6,7 +6,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("contatos", "0002_auto_20151104_0810"),
]

1
sigi/apps/contatos/migrations/0004_auto_20210611_0946.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("contatos", "0003_auto_20210416_0841"),
]

1
sigi/apps/contatos/migrations/0005_alter_mesorregiao_options_alter_microrregiao_options_and_more.py

@ -6,7 +6,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("contatos", "0004_auto_20210611_0946"),
]

1
sigi/apps/contatos/migrations/0006_alter_unidadefederativa_regiao.py

@ -16,7 +16,6 @@ def acerta_sudeste_rw(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
(
"contatos",

4
sigi/apps/contatos/models.py

@ -32,7 +32,9 @@ class UnidadeFederativa(models.Model):
unique=True,
help_text=_("Exemplo: <em>MG</em>."),
)
regiao = models.CharField(_("região"), max_length=2, choices=REGIAO_CHOICES)
regiao = models.CharField(
_("região"), max_length=2, choices=REGIAO_CHOICES
)
populacao = models.PositiveIntegerField(_("população"))
class Meta:

8
sigi/apps/convenios/filters.py

@ -7,7 +7,9 @@ class TipoProjetoFilter(admin.FieldListFilter):
parameter_name = "convenio"
def __init__(self, field, request, params, model, model_admin, field_path):
super().__init__(field, request, params, model, model_admin, field_path)
super().__init__(
field, request, params, model, model_admin, field_path
)
self.lookup_choices = self.lookups(request, model_admin)
if self.lookup_choices is None:
@ -61,7 +63,9 @@ class ExcluirTipoProjetoFilter(admin.FieldListFilter):
parameter_name = "excluir_convenio"
def __init__(self, field, request, params, model, model_admin, field_path):
super().__init__(field, request, params, model, model_admin, field_path)
super().__init__(
field, request, params, model, model_admin, field_path
)
self.title = _(f"Excluir {self.title}")
self.lookup_choices = self.lookups(request, model_admin)

4
sigi/apps/convenios/migrations/0001_initial.py

@ -6,7 +6,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("inventario", "__first__"),
("casas", "0001_initial"),
@ -28,7 +27,8 @@ class Migration(migrations.Migration):
(
"arquivo",
models.FileField(
max_length=500, upload_to="apps/convenios/anexo/arquivo"
max_length=500,
upload_to="apps/convenios/anexo/arquivo",
),
),
(

1
sigi/apps/convenios/migrations/0002_convenio_duracao.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0001_initial"),
]

1
sigi/apps/convenios/migrations/0003_auto_20210406_1945.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0002_convenio_duracao"),
("casas", "0014_auto_20210406_1945"),

1
sigi/apps/convenios/migrations/0004_auto_20210407_1928.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("servidores", "0001_initial"),
("convenios", "0003_auto_20210406_1945"),

1
sigi/apps/convenios/migrations/0005_auto_20210409_0842.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0004_auto_20210407_1928"),
]

1
sigi/apps/convenios/migrations/0006_auto_20210416_0841.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("convenios", "0005_auto_20210409_0842"),
]

1
sigi/apps/convenios/migrations/0007_auto_20210416_0918.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("convenios", "0006_auto_20210416_0841"),
]

1
sigi/apps/convenios/migrations/0008_auto_20210422_1907.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("servidores", "0004_auto_20210422_1907"),
("convenios", "0007_auto_20210416_0918"),

1
sigi/apps/convenios/migrations/0009_auto_20210611_0946.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0008_auto_20210422_1907"),
]

1
sigi/apps/convenios/migrations/0010_auto_20210819_0833.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0009_auto_20210611_0946"),
]

1
sigi/apps/convenios/migrations/0011_convenio_data_termino_vigencia.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0010_auto_20210819_0833"),
]

1
sigi/apps/convenios/migrations/0012_auto_20210831_0844.py

@ -29,7 +29,6 @@ def migra_data_termino_vigencia(apps, schema_editor):
class Migration(migrations.Migration):
dependencies = [
("convenios", "0011_convenio_data_termino_vigencia"),
]

1
sigi/apps/convenios/migrations/0013_remove_convenio_duracao.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0012_auto_20210831_0844"),
]

1
sigi/apps/convenios/migrations/0014_gescon.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0013_remove_convenio_duracao"),
]

1
sigi/apps/convenios/migrations/0015_remove_convenio_search_text.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0014_gescon"),
]

1
sigi/apps/convenios/migrations/0016_auto_20210909_0732.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0015_remove_convenio_search_text"),
]

1
sigi/apps/convenios/migrations/0017_convenio_id_contrato_gescon.py

@ -4,7 +4,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("convenios", "0016_auto_20210909_0732"),
]

1
sigi/apps/convenios/migrations/0018_auto_20211208_1256.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("convenios", "0017_convenio_id_contrato_gescon"),
]

6
sigi/apps/convenios/migrations/0019_alter_anexo_arquivo_alter_anexo_descricao_and_more.py

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("convenios", "0018_auto_20211208_1256"),
]
@ -126,7 +125,10 @@ class Migration(migrations.Migration):
model_name="tramitacao",
name="observacao",
field=models.CharField(
blank=True, max_length=512, null=True, verbose_name="observação"
blank=True,
max_length=512,
null=True,
verbose_name="observação",
),
),
migrations.AlterField(

1
sigi/apps/convenios/migrations/0020_gescon_orgaos_gestores.py

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
(
"convenios",

23
sigi/apps/convenios/migrations/0021_projeto_texto_minuta_projeto_texto_oficio.py

@ -5,20 +5,27 @@ import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('convenios', '0020_gescon_orgaos_gestores'),
("convenios", "0020_gescon_orgaos_gestores"),
]
operations = [
migrations.AddField(
model_name='projeto',
name='texto_minuta',
field=tinymce.models.HTMLField(blank=True, help_text='Use as seguintes marcações:<ul><li>{{ casa.nome }} para o nome da Casa Legislativa / órgão</li><li>{{ casa.municipio.uf.sigla }} para a sigla da UF da Casa legislativa</li><li>{{ presidente.nome }} para o nome do presidente</li><li>{{ contato.nome }} para o nome do contato Interlegis</li></ul>', verbose_name='texto da minuta'),
model_name="projeto",
name="texto_minuta",
field=tinymce.models.HTMLField(
blank=True,
help_text="Use as seguintes marcações:<ul><li>{{ casa.nome }} para o nome da Casa Legislativa / órgão</li><li>{{ casa.municipio.uf.sigla }} para a sigla da UF da Casa legislativa</li><li>{{ presidente.nome }} para o nome do presidente</li><li>{{ contato.nome }} para o nome do contato Interlegis</li></ul>",
verbose_name="texto da minuta",
),
),
migrations.AddField(
model_name='projeto',
name='texto_oficio',
field=tinymce.models.HTMLField(blank=True, help_text='Use as seguintes marcações:<ul><li>{{ casa.nome }} para o nome da Casa Legislativa / órgão</li><li>{{ casa.municipio.uf.sigla }} para a sigla da UF da Casa legislativa</li><li>{{ presidente.nome }} para o nome do presidente</li><li>{{ contato.nome }} para o nome do contato Interlegis</li></ul>', verbose_name='texto do ofício'),
model_name="projeto",
name="texto_oficio",
field=tinymce.models.HTMLField(
blank=True,
help_text="Use as seguintes marcações:<ul><li>{{ casa.nome }} para o nome da Casa Legislativa / órgão</li><li>{{ casa.municipio.uf.sigla }} para a sigla da UF da Casa legislativa</li><li>{{ presidente.nome }} para o nome do presidente</li><li>{{ contato.nome }} para o nome do contato Interlegis</li></ul>",
verbose_name="texto do ofício",
),
),
]

19
sigi/apps/convenios/migrations/0022_remove_projeto_texto_minuta_projeto_modelo_minuta.py

@ -5,19 +5,24 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('convenios', '0021_projeto_texto_minuta_projeto_texto_oficio'),
("convenios", "0021_projeto_texto_minuta_projeto_texto_oficio"),
]
operations = [
migrations.RemoveField(
model_name='projeto',
name='texto_minuta',
model_name="projeto",
name="texto_minuta",
),
migrations.AddField(
model_name='projeto',
name='modelo_minuta',
field=models.FileField(blank=True, help_text='Use as seguintes marcações:<ul><li>{{ casa.nome }} para o nome da Casa Legislativa / órgão</li><li>{{ casa.municipio.uf.sigla }} para a sigla da UF da Casa legislativa</li><li>{{ presidente.nome }} para o nome do presidente</li><li>{{ contato.nome }} para o nome do contato Interlegis</li></ul>', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator], verbose_name='Modelo de minuta'),
model_name="projeto",
name="modelo_minuta",
field=models.FileField(
blank=True,
help_text="Use as seguintes marcações:<ul><li>{{ casa.nome }} para o nome da Casa Legislativa / órgão</li><li>{{ casa.municipio.uf.sigla }} para a sigla da UF da Casa legislativa</li><li>{{ presidente.nome }} para o nome do presidente</li><li>{{ contato.nome }} para o nome do contato Interlegis</li></ul>",
upload_to="convenios/minutas/",
validators=[django.core.validators.FileExtensionValidator],
verbose_name="Modelo de minuta",
),
),
]

30
sigi/apps/convenios/migrations/0023_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

12
sigi/apps/convenios/migrations/0024_alter_anexo_data_pub.py

@ -5,15 +5,17 @@ import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('convenios', '0023_alter_projeto_modelo_minuta_and_more'),
("convenios", "0023_alter_projeto_modelo_minuta_and_more"),
]
operations = [
migrations.AlterField(
model_name='anexo',
name='data_pub',
field=models.DateTimeField(default=django.utils.timezone.localtime, verbose_name='data da publicação do anexo'),
model_name="anexo",
name="data_pub",
field=models.DateTimeField(
default=django.utils.timezone.localtime,
verbose_name="data da publicação do anexo",
),
),
]

27
sigi/apps/convenios/migrations/0025_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

27
sigi/apps/convenios/migrations/0026_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

27
sigi/apps/convenios/migrations/0027_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

27
sigi/apps/convenios/migrations/0028_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

27
sigi/apps/convenios/migrations/0029_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

27
sigi/apps/convenios/migrations/0030_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

27
sigi/apps/convenios/migrations/0031_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

1
sigi/apps/convenios/migrations/0032_gescon_palavras_excluir.py

@ -4,7 +4,6 @@ from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("convenios", "0031_alter_projeto_modelo_minuta_and_more"),
]

5
sigi/apps/convenios/migrations/0033_alter_projeto_modelo_minuta_and_more.py

File diff suppressed because one or more lines are too long

12
sigi/apps/convenios/models.py

@ -295,7 +295,9 @@ class Convenio(models.Model):
_("data de devolução da via"),
null=True,
blank=True,
help_text=_("Data de devolução da via do convênio à Câmara Municipal."),
help_text=_(
"Data de devolução da via do convênio à Câmara Municipal."
),
)
data_postagem_correio = models.DateField(
_("data postagem correio"),
@ -732,7 +734,9 @@ class Gescon(models.Model):
numero = contrato["numero"].zfill(8)
numero = f"{numero[:4]}/{numero[4:]}"
sigad = contrato["processo"].zfill(17)
sigad = f"{sigad[:5]}.{sigad[5:11]}/{sigad[11:15]}-{sigad[15:]}"
sigad = (
f"{sigad[:5]}.{sigad[5:11]}/{sigad[11:15]}-{sigad[15:]}"
)
if contrato["cnpjCpfFornecedor"]:
cnpj = contrato["cnpjCpfFornecedor"].zfill(14)
@ -904,7 +908,9 @@ class Gescon(models.Model):
convenio.data_retorno_assinatura = contrato[
"inicioVigencia"
]
convenio.data_termino_vigencia = contrato["terminoVigencia"]
convenio.data_termino_vigencia = contrato[
"terminoVigencia"
]
convenio.data_pub_diario = contrato["publicacao"]
if contrato["codTextoContrato"]:
convenio.id_contrato_gescon = contrato[

8
sigi/apps/convenios/views.py

@ -70,7 +70,9 @@ def casas_estado_to_tabela(casas, convenios, regiao):
for estado in estados:
linha = LinhaEstado()
convenios_est = convenios.filter(casa_legislativa__municipio__uf=estado)
convenios_est = convenios.filter(
casa_legislativa__municipio__uf=estado
)
convenios_est_publicados = convenios_est.exclude(data_pub_diario=None)
convenios_est_equipados = convenios_est.exclude(data_termo_aceite=None)
@ -104,7 +106,9 @@ def casas_estado_to_tabela(casas, convenios, regiao):
convenios_regiao = convenios.filter(
casa_legislativa__municipio__uf__regiao=regiao
)
convenios_regiao_publicados = convenios_regiao.exclude(data_pub_diario=None)
convenios_regiao_publicados = convenios_regiao.exclude(
data_pub_diario=None
)
convenios_regiao_equipados = convenios_regiao.exclude(
data_termo_aceite=None
)

4
sigi/apps/diagnosticos/admin.py

@ -127,7 +127,9 @@ class DiagnosticoAdmin(BaseEntityAdmin):
perguntas_by_title = [
(p.title, p.name) for p in categoria.perguntas.all()
]
perguntas = [pergunta[1] for pergunta in sorted(perguntas_by_title)]
perguntas = [
pergunta[1] for pergunta in sorted(perguntas_by_title)
]
eav_fieldsets += (
(

9
sigi/apps/diagnosticos/forms.py

@ -117,7 +117,6 @@ class DiagnosticoMobileForm(BaseDynamicEntityForm):
# Se determinada pergunta é da categoria pesquisada,
# então, gere o campo no formulário.
for schema in self.instance.get_schemata(int(category)):
defaults = {
"label": schema.title,
"required": schema.required,
@ -140,7 +139,9 @@ class DiagnosticoMobileForm(BaseDynamicEntityForm):
"queryset": schema.get_choices(),
"initial": choice.pk if choice else None,
# if schema is required remove --------- from ui
"empty_label": None if schema.required else "---------",
"empty_label": None
if schema.required
else "---------",
}
)
@ -191,7 +192,9 @@ class OrgaoMobileForm(forms.ModelForm):
def save(self, commit=True):
super(OrgaoMobileForm, self).save(commit=True)
self.instance.municipio.data_criacao = self.cleaned_data["data_criacao"]
self.instance.municipio.data_criacao = self.cleaned_data[
"data_criacao"
]
if commit:
self.instance.municipio.save()
return self.instance

3
sigi/apps/diagnosticos/management/commands/ls_export.py

@ -25,7 +25,8 @@ class Command(BaseCommand):
)
setores = [
(i + 1, s[0], s[1]) for i, s in enumerate(Funcionario.SETOR_CHOICES)
(i + 1, s[0], s[1])
for i, s in enumerate(Funcionario.SETOR_CHOICES)
]
if len(args) < 2:

5
sigi/apps/diagnosticos/migrations/0001_initial.py

@ -8,7 +8,6 @@ import sigi.apps.utils
class Migration(migrations.Migration):
dependencies = [
("servidores", "0001_initial"),
("contenttypes", "0001_initial"),
@ -235,7 +234,9 @@ class Migration(migrations.Migration):
),
(
"required",
models.BooleanField(default=False, verbose_name="required"),
models.BooleanField(
default=False, verbose_name="required"
),
),
(
"searched",

1
sigi/apps/diagnosticos/migrations/0002_auto_20160719_0920.py

@ -7,7 +7,6 @@ import eav.models
class Migration(migrations.Migration):
dependencies = [
("diagnosticos", "0001_initial"),
]

1
sigi/apps/diagnosticos/migrations/0002_auto_20170407_1024.py

@ -7,7 +7,6 @@ import eav.models
class Migration(migrations.Migration):
dependencies = [
("diagnosticos", "0001_initial"),
]

1
sigi/apps/diagnosticos/migrations/0003_auto_20201101_2240.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("diagnosticos", "0002_auto_20170407_1024"),
]

1
sigi/apps/diagnosticos/migrations/0004_auto_20210406_1945.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("diagnosticos", "0003_auto_20201101_2240"),
("casas", "0014_auto_20210406_1945"),

1
sigi/apps/diagnosticos/migrations/0005_auto_20210416_0841.py

@ -6,7 +6,6 @@ import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("diagnosticos", "0004_auto_20210406_1945"),
]

1
sigi/apps/diagnosticos/migrations/0006_merge.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("diagnosticos", "0002_auto_20160719_0920"),
("diagnosticos", "0005_auto_20210416_0841"),

9
sigi/apps/diagnosticos/views.py

@ -120,7 +120,6 @@ def categoria_detalhes(request, id_diagnostico, id_categoria):
@login_required(login_url=LOGIN_REDIRECT_URL)
@validate_diagnostico
def categoria_casa_legislativa(request, id_diagnostico):
# Grava na sessão a categoria atual, para destacar que
# era foi a última visitada.
request.session["ultima_categoria"] = 1
@ -159,7 +158,6 @@ def categoria_casa_legislativa(request, id_diagnostico):
@login_required(login_url=LOGIN_REDIRECT_URL)
@validate_diagnostico
def categoria_contatos(request, id_diagnostico):
# Grava na sessão a categoria atual, para destacar que
# era foi a última visitada.
request.session["ultima_categoria"] = 2
@ -246,7 +244,10 @@ def categoria_contatos(request, id_diagnostico):
number=form_telefones.instance.numero,
)
else:
for key, value in form_telefones.errors.iteritems():
for (
key,
value,
) in form_telefones.errors.iteritems():
key = form_telefones.prefix + "-id-errors"
resposta["erros"][key] = value
@ -345,7 +346,6 @@ def percentage(fraction, population):
@login_required
def grafico_api(request):
colors = cycle(
[
"#7cb5ec",
@ -380,7 +380,6 @@ def grafico_api(request):
pergunta = get_object_or_404(Pergunta, name=pergunta_slug)
if pergunta.datatype == "one":
list_perguntas = pergunta.group_choices()
list_perguntas = [
{

4
sigi/apps/diagnosticos/widgets.py

@ -27,7 +27,9 @@ class EavCheckboxSelectMultiple(CheckboxSelectMultiple):
# Caso exista uma pergunta para abrir
# adiciona um atripbuto no checkbox
schema_to_open = Escolha.objects.get(pk=option_value).schema_to_open
schema_to_open = Escolha.objects.get(
pk=option_value
).schema_to_open
if schema_to_open:
final_attrs["schema_to_open"] = schema_to_open.name

34
sigi/apps/eventos/admin.py

@ -80,7 +80,9 @@ class EventoResource(ValueLabeledResource):
export_order = fields
def dehydrate_tipo_evento__categoria(self, obj):
return dict(TipoEvento.CATEGORIA_CHOICES)[obj["tipo_evento__categoria"]]
return dict(TipoEvento.CATEGORIA_CHOICES)[
obj["tipo_evento__categoria"]
]
def dehydrate_virtual(self, obj):
return "Sim" if obj["virtual"] else "Não"
@ -356,7 +358,13 @@ class EventoAdmin(CartExportMixin, admin.ModelAdmin):
evento.cronograma_set.order_by("data_prevista_inicio")
)
if not cronograma:
self.message_user(request, _("Não há um cronograma definido para a realização deste evento. Impossível gerar um gráfico de Gant"), messages.ERROR)
self.message_user(
request,
_(
"Não há um cronograma definido para a realização deste evento. Impossível gerar um gráfico de Gant"
),
messages.ERROR,
)
return redirect(change_url)
inicio = min(
@ -365,7 +373,8 @@ class EventoAdmin(CartExportMixin, admin.ModelAdmin):
)
termino = max(
cronograma[-1].data_prevista_termino,
cronograma[-1].data_termino or cronograma[-1].data_prevista_termino,
cronograma[-1].data_termino
or cronograma[-1].data_prevista_termino,
)
datas = [
inicio + datetime.timedelta(days=x)
@ -399,7 +408,13 @@ class EventoAdmin(CartExportMixin, admin.ModelAdmin):
evento.cronograma_set.order_by("data_prevista_inicio")
)
if not cronograma:
self.message_user(request, _("Não há um cronograma definido para a realização deste evento. Impossível gerar um checklist"), messages.ERROR)
self.message_user(
request,
_(
"Não há um cronograma definido para a realização deste evento. Impossível gerar um checklist"
),
messages.ERROR,
)
return redirect(change_url)
context = {"cronograma": cronograma, "title": evento.nome}
@ -424,7 +439,13 @@ class EventoAdmin(CartExportMixin, admin.ModelAdmin):
evento.cronograma_set.order_by("data_prevista_inicio")
)
if not cronograma:
self.message_user(request, _("Não há um cronograma definido para a realização deste evento. Impossível gerar um plano de comunicação"), messages.ERROR)
self.message_user(
request,
_(
"Não há um cronograma definido para a realização deste evento. Impossível gerar um plano de comunicação"
),
messages.ERROR,
)
return redirect(change_url)
matrix = {}
@ -616,7 +637,8 @@ class EventoAdmin(CartExportMixin, admin.ModelAdmin):
mws = Moodle(api_url, settings.MOODLE_API_TOKEN)
try:
inscritos = mws.post(
"core_enrol_get_enrolled_users", courseid=evento.moodle_courseid
"core_enrol_get_enrolled_users",
courseid=evento.moodle_courseid,
)
except Exception as e:
self.message_user(

6
sigi/apps/eventos/migrations/0001_initial.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("servidores", "0001_initial"),
("contatos", "0001_initial"),
@ -228,7 +227,10 @@ class Migration(migrations.Migration):
primary_key=True,
),
),
("nome", models.CharField(max_length=100, verbose_name="Nome")),
(
"nome",
models.CharField(max_length=100, verbose_name="Nome"),
),
],
options={
"ordering": ("nome",),

1
sigi/apps/eventos/migrations/0002_auto_20151016_1449.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("eventos", "0001_initial"),
]

1
sigi/apps/eventos/migrations/0003_auto_20151104_0810.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("eventos", "0002_auto_20151016_1449"),
]

1
sigi/apps/eventos/migrations/0004_auto_20160719_0920.py

@ -5,7 +5,6 @@ from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("eventos", "0003_auto_20151104_0810"),
]

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save