diff --git a/conftest.py b/conftest.py index b9ff21f..c4eb0e1 100644 --- a/conftest.py +++ b/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. diff --git a/manage.py b/manage.py index 8884f43..1ee01ed 100755 --- a/manage.py +++ b/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() diff --git a/scripts/casas_com_PM_e_SAPL.py b/scripts/casas_com_PM_e_SAPL.py index b382da3..f6620ff 100644 --- a/scripts/casas_com_PM_e_SAPL.py +++ b/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 diff --git a/scripts/casas_que_usam_LEGBR_ou_PM.py b/scripts/casas_que_usam_LEGBR_ou_PM.py index 2dc8aeb..f4fcdac 100644 --- a/scripts/casas_que_usam_LEGBR_ou_PM.py +++ b/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 = '/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, + ] + ) diff --git a/scripts/contatos_de_casas_que_usam_portalmodelo.py b/scripts/contatos_de_casas_que_usam_portalmodelo.py index 32dc761..1271a7d 100644 --- a/scripts/contatos_de_casas_que_usam_portalmodelo.py +++ b/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 = '/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", + ] + ) diff --git a/scripts/csv_writer.py b/scripts/csv_writer.py index acf485d..62514c8 100644 --- a/scripts/csv_writer.py +++ b/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]) diff --git a/scripts/urls de portais modelo por estado municipio.py b/scripts/urls de portais modelo por estado municipio.py index f8908bb..7fa850b 100644 --- a/scripts/urls de portais modelo por estado municipio.py +++ b/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")) diff --git a/setup.py b/setup.py index e2fa531..abb125d 100644 --- a/setup.py +++ b/setup.py @@ -5,4 +5,4 @@ from distutils.core import setup -setup(name='sigi', version='3.x') +setup(name="sigi", version="3.x") diff --git a/sigi/apps/casas/admin.py b/sigi/apps/casas/admin.py index c58181a..69db681 100644 --- a/sigi/apps/casas/admin.py +++ b/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"), { diff --git a/sigi/apps/casas/jobs/daily/usuario_contato.py b/sigi/apps/casas/jobs/daily/usuario_contato.py index 5b766c9..2d13d36 100644 --- a/sigi/apps/casas/jobs/daily/usuario_contato.py +++ b/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") diff --git a/sigi/apps/casas/migrations/0001_initial.py b/sigi/apps/casas/migrations/0001_initial.py index 11ee4e6..471704e 100644 --- a/sigi/apps/casas/migrations/0001_initial.py +++ b/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"), diff --git a/sigi/apps/casas/migrations/0002_auto_20150710_1247.py b/sigi/apps/casas/migrations/0002_auto_20150710_1247.py index 06c78a8..17da9ba 100644 --- a/sigi/apps/casas/migrations/0002_auto_20150710_1247.py +++ b/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"), diff --git a/sigi/apps/casas/migrations/0003_auto_20200207_0919.py b/sigi/apps/casas/migrations/0003_auto_20200207_0919.py index a6a2908..a8e4c75 100644 --- a/sigi/apps/casas/migrations/0003_auto_20200207_0919.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0004_auto_20201015_0810.py b/sigi/apps/casas/migrations/0004_auto_20201015_0810.py index a4b46f2..2ec789d 100644 --- a/sigi/apps/casas/migrations/0004_auto_20201015_0810.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0005_casalegislativa_gerentes_interlegis.py b/sigi/apps/casas/migrations/0005_casalegislativa_gerentes_interlegis.py index 5abafe8..c287e10 100644 --- a/sigi/apps/casas/migrations/0005_casalegislativa_gerentes_interlegis.py +++ b/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"), diff --git a/sigi/apps/casas/migrations/0006_remove_casalegislativa_gerente_contas.py b/sigi/apps/casas/migrations/0006_remove_casalegislativa_gerente_contas.py index f8da79e..226c094 100644 --- a/sigi/apps/casas/migrations/0006_remove_casalegislativa_gerente_contas.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0007_auto_20201016_1632.py b/sigi/apps/casas/migrations/0007_auto_20201016_1632.py index 7b3384f..fadcc03 100644 --- a/sigi/apps/casas/migrations/0007_auto_20201016_1632.py +++ b/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( diff --git a/sigi/apps/casas/migrations/0008_auto_20210218_1007.py b/sigi/apps/casas/migrations/0008_auto_20210218_1007.py index 26b3445..04d0fa5 100644 --- a/sigi/apps/casas/migrations/0008_auto_20210218_1007.py +++ b/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"), diff --git a/sigi/apps/casas/migrations/0009_auto_20210406_1055.py b/sigi/apps/casas/migrations/0009_auto_20210406_1055.py index c6306c1..6d2e4e1 100644 --- a/sigi/apps/casas/migrations/0009_auto_20210406_1055.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0010_auto_20210406_1101.py b/sigi/apps/casas/migrations/0010_auto_20210406_1101.py index 638c9ba..b363613 100644 --- a/sigi/apps/casas/migrations/0010_auto_20210406_1101.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0011_auto_20210406_1135.py b/sigi/apps/casas/migrations/0011_auto_20210406_1135.py index 4d806d8..3d2da76 100644 --- a/sigi/apps/casas/migrations/0011_auto_20210406_1135.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0012_auto_20210406_1420.py b/sigi/apps/casas/migrations/0012_auto_20210406_1420.py index 806a95b..d8c6449 100644 --- a/sigi/apps/casas/migrations/0012_auto_20210406_1420.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0013_auto_20210406_1428.py b/sigi/apps/casas/migrations/0013_auto_20210406_1428.py index 4767dcf..99a5137 100644 --- a/sigi/apps/casas/migrations/0013_auto_20210406_1428.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0014_auto_20210406_1945.py b/sigi/apps/casas/migrations/0014_auto_20210406_1945.py index 2444406..a1e4be3 100644 --- a/sigi/apps/casas/migrations/0014_auto_20210406_1945.py +++ b/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"), diff --git a/sigi/apps/casas/migrations/0015_auto_20210407_0801.py b/sigi/apps/casas/migrations/0015_auto_20210407_0801.py index af7f1fc..9c44e90 100644 --- a/sigi/apps/casas/migrations/0015_auto_20210407_0801.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0016_auto_20210407_1559.py b/sigi/apps/casas/migrations/0016_auto_20210407_1559.py index 8480fb8..6eb9b3f 100644 --- a/sigi/apps/casas/migrations/0016_auto_20210407_1559.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0017_auto_20210416_0841.py b/sigi/apps/casas/migrations/0017_auto_20210416_0841.py index 0e7bba7..c67b31d 100644 --- a/sigi/apps/casas/migrations/0017_auto_20210416_0841.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0018_orgao_sigla.py b/sigi/apps/casas/migrations/0018_orgao_sigla.py index b4e3faa..cc4bf9c 100644 --- a/sigi/apps/casas/migrations/0018_orgao_sigla.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0019_auto_20210501_1058.py b/sigi/apps/casas/migrations/0019_auto_20210501_1058.py index d5f662a..14cbbd0 100644 --- a/sigi/apps/casas/migrations/0019_auto_20210501_1058.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0020_auto_20210611_0946.py b/sigi/apps/casas/migrations/0020_auto_20210611_0946.py index fc7a9dc..37166a8 100644 --- a/sigi/apps/casas/migrations/0020_auto_20210611_0946.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0021_alter_orgao_options_remove_orgao_recorte_and_more.py b/sigi/apps/casas/migrations/0021_alter_orgao_options_remove_orgao_recorte_and_more.py index bcef4bb..509f26e 100644 --- a/sigi/apps/casas/migrations/0021_alter_orgao_options_remove_orgao_recorte_and_more.py +++ b/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", diff --git a/sigi/apps/casas/migrations/0022_orgao_brasao_orgao_brasao_altura_and_more.py b/sigi/apps/casas/migrations/0022_orgao_brasao_orgao_brasao_altura_and_more.py index cd1a09b..12cd938 100644 --- a/sigi/apps/casas/migrations/0022_orgao_brasao_orgao_brasao_altura_and_more.py +++ b/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), ), ] diff --git a/sigi/apps/casas/migrations/0023_funcionario_cpf_funcionario_identidade.py b/sigi/apps/casas/migrations/0023_funcionario_cpf_funcionario_identidade.py index 0412fe3..efa3cf4 100644 --- a/sigi/apps/casas/migrations/0023_funcionario_cpf_funcionario_identidade.py +++ b/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)", + ), ), ] diff --git a/sigi/apps/casas/migrations/0024_delete_presidente.py b/sigi/apps/casas/migrations/0024_delete_presidente.py index 512fbfe..133b9e2 100644 --- a/sigi/apps/casas/migrations/0024_delete_presidente.py +++ b/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", ), ] diff --git a/sigi/apps/casas/migrations/0025_orgao_telefone_geral.py b/sigi/apps/casas/migrations/0025_orgao_telefone_geral.py index 7d6c112..54c66cd 100644 --- a/sigi/apps/casas/migrations/0025_orgao_telefone_geral.py +++ b/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: (31)8851-9898.', max_length=64, verbose_name='telefone geral'), + model_name="orgao", + name="telefone_geral", + field=models.CharField( + blank=True, + default="", + help_text="Exemplo: (31)8851-9898.", + max_length=64, + verbose_name="telefone geral", + ), ), ] diff --git a/sigi/apps/casas/migrations/0026_carga_telefone_geral.py b/sigi/apps/casas/migrations/0026_carga_telefone_geral.py index 2462a32..ace6743 100644 --- a/sigi/apps/casas/migrations/0026_carga_telefone_geral.py +++ b/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"), ] diff --git a/sigi/apps/casas/migrations/0027_alter_orgao_email.py b/sigi/apps/casas/migrations/0027_alter_orgao_email.py index cc1546f..0846091 100644 --- a/sigi/apps/casas/migrations/0027_alter_orgao_email.py +++ b/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" + ), ), ] diff --git a/sigi/apps/casas/models.py b/sigi/apps/casas/models.py index dfb0e0f..222e9e1 100644 --- a/sigi/apps/casas/models.py +++ b/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 ) diff --git a/sigi/apps/casas/views.py b/sigi/apps/casas/views.py index d6f2065..9deb390 100644 --- a/sigi/apps/casas/views.py +++ b/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 diff --git a/sigi/apps/contatos/jobs/monthly/atualiza_ibge.py b/sigi/apps/contatos/jobs/monthly/atualiza_ibge.py index ce13e8d..1df8e16 100644 --- a/sigi/apps/contatos/jobs/monthly/atualiza_ibge.py +++ b/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"]] diff --git a/sigi/apps/contatos/migrations/0001_initial.py b/sigi/apps/contatos/migrations/0001_initial.py index 3048369..e2aaf26 100644 --- a/sigi/apps/contatos/migrations/0001_initial.py +++ b/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={ diff --git a/sigi/apps/contatos/migrations/0002_auto_20151104_0810.py b/sigi/apps/contatos/migrations/0002_auto_20151104_0810.py index e1aaadb..3c8fdfb 100644 --- a/sigi/apps/contatos/migrations/0002_auto_20151104_0810.py +++ b/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"), ] diff --git a/sigi/apps/contatos/migrations/0003_auto_20210416_0841.py b/sigi/apps/contatos/migrations/0003_auto_20210416_0841.py index 3402c25..bc78f97 100644 --- a/sigi/apps/contatos/migrations/0003_auto_20210416_0841.py +++ b/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"), ] diff --git a/sigi/apps/contatos/migrations/0004_auto_20210611_0946.py b/sigi/apps/contatos/migrations/0004_auto_20210611_0946.py index 4af2062..21c2aaf 100644 --- a/sigi/apps/contatos/migrations/0004_auto_20210611_0946.py +++ b/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"), ] diff --git a/sigi/apps/contatos/migrations/0005_alter_mesorregiao_options_alter_microrregiao_options_and_more.py b/sigi/apps/contatos/migrations/0005_alter_mesorregiao_options_alter_microrregiao_options_and_more.py index 113e2b9..510b71d 100644 --- a/sigi/apps/contatos/migrations/0005_alter_mesorregiao_options_alter_microrregiao_options_and_more.py +++ b/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"), ] diff --git a/sigi/apps/contatos/migrations/0006_alter_unidadefederativa_regiao.py b/sigi/apps/contatos/migrations/0006_alter_unidadefederativa_regiao.py index 968e9cf..3843d12 100644 --- a/sigi/apps/contatos/migrations/0006_alter_unidadefederativa_regiao.py +++ b/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", diff --git a/sigi/apps/contatos/models.py b/sigi/apps/contatos/models.py index 640fe8d..3746427 100644 --- a/sigi/apps/contatos/models.py +++ b/sigi/apps/contatos/models.py @@ -32,7 +32,9 @@ class UnidadeFederativa(models.Model): unique=True, help_text=_("Exemplo: MG."), ) - 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: diff --git a/sigi/apps/convenios/filters.py b/sigi/apps/convenios/filters.py index 494ce3a..62eec6b 100644 --- a/sigi/apps/convenios/filters.py +++ b/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) diff --git a/sigi/apps/convenios/migrations/0001_initial.py b/sigi/apps/convenios/migrations/0001_initial.py index 3e21724..015f011 100644 --- a/sigi/apps/convenios/migrations/0001_initial.py +++ b/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", ), ), ( diff --git a/sigi/apps/convenios/migrations/0002_convenio_duracao.py b/sigi/apps/convenios/migrations/0002_convenio_duracao.py index 772eab1..dd76434 100644 --- a/sigi/apps/convenios/migrations/0002_convenio_duracao.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0003_auto_20210406_1945.py b/sigi/apps/convenios/migrations/0003_auto_20210406_1945.py index 30ca8f2..0b7601e 100644 --- a/sigi/apps/convenios/migrations/0003_auto_20210406_1945.py +++ b/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"), diff --git a/sigi/apps/convenios/migrations/0004_auto_20210407_1928.py b/sigi/apps/convenios/migrations/0004_auto_20210407_1928.py index fcf7634..b2548b1 100644 --- a/sigi/apps/convenios/migrations/0004_auto_20210407_1928.py +++ b/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"), diff --git a/sigi/apps/convenios/migrations/0005_auto_20210409_0842.py b/sigi/apps/convenios/migrations/0005_auto_20210409_0842.py index 08e22eb..e4bb961 100644 --- a/sigi/apps/convenios/migrations/0005_auto_20210409_0842.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0006_auto_20210416_0841.py b/sigi/apps/convenios/migrations/0006_auto_20210416_0841.py index 8b7aa7d..bf48012 100644 --- a/sigi/apps/convenios/migrations/0006_auto_20210416_0841.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0007_auto_20210416_0918.py b/sigi/apps/convenios/migrations/0007_auto_20210416_0918.py index fe28c47..47c0ddf 100644 --- a/sigi/apps/convenios/migrations/0007_auto_20210416_0918.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0008_auto_20210422_1907.py b/sigi/apps/convenios/migrations/0008_auto_20210422_1907.py index a3f0f23..87abb04 100644 --- a/sigi/apps/convenios/migrations/0008_auto_20210422_1907.py +++ b/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"), diff --git a/sigi/apps/convenios/migrations/0009_auto_20210611_0946.py b/sigi/apps/convenios/migrations/0009_auto_20210611_0946.py index 6b57de9..ddc6452 100644 --- a/sigi/apps/convenios/migrations/0009_auto_20210611_0946.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0010_auto_20210819_0833.py b/sigi/apps/convenios/migrations/0010_auto_20210819_0833.py index 1fc9795..2da072c 100644 --- a/sigi/apps/convenios/migrations/0010_auto_20210819_0833.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0011_convenio_data_termino_vigencia.py b/sigi/apps/convenios/migrations/0011_convenio_data_termino_vigencia.py index 0838215..44edd1a 100644 --- a/sigi/apps/convenios/migrations/0011_convenio_data_termino_vigencia.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0012_auto_20210831_0844.py b/sigi/apps/convenios/migrations/0012_auto_20210831_0844.py index e9f19e1..8072c21 100644 --- a/sigi/apps/convenios/migrations/0012_auto_20210831_0844.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0013_remove_convenio_duracao.py b/sigi/apps/convenios/migrations/0013_remove_convenio_duracao.py index 409dfbd..de2cd45 100644 --- a/sigi/apps/convenios/migrations/0013_remove_convenio_duracao.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0014_gescon.py b/sigi/apps/convenios/migrations/0014_gescon.py index 247e3a8..da793b7 100644 --- a/sigi/apps/convenios/migrations/0014_gescon.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0015_remove_convenio_search_text.py b/sigi/apps/convenios/migrations/0015_remove_convenio_search_text.py index 69d7777..bcf5983 100644 --- a/sigi/apps/convenios/migrations/0015_remove_convenio_search_text.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0016_auto_20210909_0732.py b/sigi/apps/convenios/migrations/0016_auto_20210909_0732.py index c74569f..04e190e 100644 --- a/sigi/apps/convenios/migrations/0016_auto_20210909_0732.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0017_convenio_id_contrato_gescon.py b/sigi/apps/convenios/migrations/0017_convenio_id_contrato_gescon.py index de8df4c..3f30a21 100644 --- a/sigi/apps/convenios/migrations/0017_convenio_id_contrato_gescon.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0018_auto_20211208_1256.py b/sigi/apps/convenios/migrations/0018_auto_20211208_1256.py index 2fc383a..f48cd03 100644 --- a/sigi/apps/convenios/migrations/0018_auto_20211208_1256.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0019_alter_anexo_arquivo_alter_anexo_descricao_and_more.py b/sigi/apps/convenios/migrations/0019_alter_anexo_arquivo_alter_anexo_descricao_and_more.py index e3fee8d..8287b3a 100644 --- a/sigi/apps/convenios/migrations/0019_alter_anexo_arquivo_alter_anexo_descricao_and_more.py +++ b/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( diff --git a/sigi/apps/convenios/migrations/0020_gescon_orgaos_gestores.py b/sigi/apps/convenios/migrations/0020_gescon_orgaos_gestores.py index 9eab6be..112cdcc 100644 --- a/sigi/apps/convenios/migrations/0020_gescon_orgaos_gestores.py +++ b/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", diff --git a/sigi/apps/convenios/migrations/0021_projeto_texto_minuta_projeto_texto_oficio.py b/sigi/apps/convenios/migrations/0021_projeto_texto_minuta_projeto_texto_oficio.py index 8d7964a..fbb9a69 100644 --- a/sigi/apps/convenios/migrations/0021_projeto_texto_minuta_projeto_texto_oficio.py +++ b/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:', verbose_name='texto da minuta'), + model_name="projeto", + name="texto_minuta", + field=tinymce.models.HTMLField( + blank=True, + help_text="Use as seguintes marcações:", + 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:', 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:", + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0022_remove_projeto_texto_minuta_projeto_modelo_minuta.py b/sigi/apps/convenios/migrations/0022_remove_projeto_texto_minuta_projeto_modelo_minuta.py index 6dfea4c..51a019b 100644 --- a/sigi/apps/convenios/migrations/0022_remove_projeto_texto_minuta_projeto_modelo_minuta.py +++ b/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:', 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:", + upload_to="convenios/minutas/", + validators=[django.core.validators.FileExtensionValidator], + verbose_name="Modelo de minuta", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0023_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0023_alter_projeto_modelo_minuta_and_more.py index a4a0fb6..e997914 100644 --- a/sigi/apps/convenios/migrations/0023_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0023_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,34 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0022_remove_projeto_texto_minuta_projeto_modelo_minuta'), + ( + "convenios", + "0022_remove_projeto_texto_minuta_projeto_modelo_minuta", + ), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0024_alter_anexo_data_pub.py b/sigi/apps/convenios/migrations/0024_alter_anexo_data_pub.py index 73657f6..fef4629 100644 --- a/sigi/apps/convenios/migrations/0024_alter_anexo_data_pub.py +++ b/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", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0025_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0025_alter_projeto_modelo_minuta_and_more.py index 81fe8c1..da00b7a 100644 --- a/sigi/apps/convenios/migrations/0025_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0025_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0024_alter_anexo_data_pub'), + ("convenios", "0024_alter_anexo_data_pub"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0026_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0026_alter_projeto_modelo_minuta_and_more.py index ce7dc7d..843f3dd 100644 --- a/sigi/apps/convenios/migrations/0026_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0026_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0025_alter_projeto_modelo_minuta_and_more'), + ("convenios", "0025_alter_projeto_modelo_minuta_and_more"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0027_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0027_alter_projeto_modelo_minuta_and_more.py index aaa374a..d877711 100644 --- a/sigi/apps/convenios/migrations/0027_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0027_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0026_alter_projeto_modelo_minuta_and_more'), + ("convenios", "0026_alter_projeto_modelo_minuta_and_more"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0028_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0028_alter_projeto_modelo_minuta_and_more.py index 8bffff2..aa03e18 100644 --- a/sigi/apps/convenios/migrations/0028_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0028_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0027_alter_projeto_modelo_minuta_and_more'), + ("convenios", "0027_alter_projeto_modelo_minuta_and_more"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0029_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0029_alter_projeto_modelo_minuta_and_more.py index 66f1196..94aacd5 100644 --- a/sigi/apps/convenios/migrations/0029_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0029_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0028_alter_projeto_modelo_minuta_and_more'), + ("convenios", "0028_alter_projeto_modelo_minuta_and_more"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0030_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0030_alter_projeto_modelo_minuta_and_more.py index d0daa11..02f2e7e 100644 --- a/sigi/apps/convenios/migrations/0030_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0030_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0029_alter_projeto_modelo_minuta_and_more'), + ("convenios", "0029_alter_projeto_modelo_minuta_and_more"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0031_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0031_alter_projeto_modelo_minuta_and_more.py index 6b13fcb..e7f226d 100644 --- a/sigi/apps/convenios/migrations/0031_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0031_alter_projeto_modelo_minuta_and_more.py @@ -6,20 +6,31 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0030_alter_projeto_modelo_minuta_and_more'), + ("convenios", "0030_alter_projeto_modelo_minuta_and_more"), ] operations = [ migrations.AlterField( - model_name='projeto', - name='modelo_minuta', - field=models.FileField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to='convenios/minutas/', validators=[django.core.validators.FileExtensionValidator(['docx'])], verbose_name='Modelo de minuta'), + model_name="projeto", + name="modelo_minuta", + field=models.FileField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + upload_to="convenios/minutas/", + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], + verbose_name="Modelo de minuta", + ), ), migrations.AlterField( - model_name='projeto', - name='texto_oficio', - field=tinymce.models.HTMLField(blank=True, help_text='\nUtilize os seguintes placeholders\n\n', verbose_name='texto do ofício'), + model_name="projeto", + name="texto_oficio", + field=tinymce.models.HTMLField( + blank=True, + help_text='\nUtilize os seguintes placeholders\n\n', + verbose_name="texto do ofício", + ), ), ] diff --git a/sigi/apps/convenios/migrations/0032_gescon_palavras_excluir.py b/sigi/apps/convenios/migrations/0032_gescon_palavras_excluir.py index e026b80..1f5c407 100644 --- a/sigi/apps/convenios/migrations/0032_gescon_palavras_excluir.py +++ b/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"), ] diff --git a/sigi/apps/convenios/migrations/0033_alter_projeto_modelo_minuta_and_more.py b/sigi/apps/convenios/migrations/0033_alter_projeto_modelo_minuta_and_more.py index bbc4a16..a913cb5 100644 --- a/sigi/apps/convenios/migrations/0033_alter_projeto_modelo_minuta_and_more.py +++ b/sigi/apps/convenios/migrations/0033_alter_projeto_modelo_minuta_and_more.py @@ -6,7 +6,6 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ ("convenios", "0032_gescon_palavras_excluir"), ] @@ -19,7 +18,9 @@ class Migration(migrations.Migration): blank=True, help_text='\nUtilize os seguintes placeholders\n\n', upload_to="convenios/minutas/", - validators=[django.core.validators.FileExtensionValidator(["docx"])], + validators=[ + django.core.validators.FileExtensionValidator(["docx"]) + ], verbose_name="Modelo de minuta", ), ), diff --git a/sigi/apps/convenios/models.py b/sigi/apps/convenios/models.py index 7d42610..0b7756c 100644 --- a/sigi/apps/convenios/models.py +++ b/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[ diff --git a/sigi/apps/convenios/views.py b/sigi/apps/convenios/views.py index a5ae746..4e86dc7 100644 --- a/sigi/apps/convenios/views.py +++ b/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 ) diff --git a/sigi/apps/diagnosticos/admin.py b/sigi/apps/diagnosticos/admin.py index a85cc12..f273682 100644 --- a/sigi/apps/diagnosticos/admin.py +++ b/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 += ( ( diff --git a/sigi/apps/diagnosticos/forms.py b/sigi/apps/diagnosticos/forms.py index 7ee088b..fef7255 100644 --- a/sigi/apps/diagnosticos/forms.py +++ b/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 diff --git a/sigi/apps/diagnosticos/management/commands/ls_export.py b/sigi/apps/diagnosticos/management/commands/ls_export.py index 2925612..faa77ca 100644 --- a/sigi/apps/diagnosticos/management/commands/ls_export.py +++ b/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: diff --git a/sigi/apps/diagnosticos/migrations/0001_initial.py b/sigi/apps/diagnosticos/migrations/0001_initial.py index 31bd2b5..e091733 100644 --- a/sigi/apps/diagnosticos/migrations/0001_initial.py +++ b/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", diff --git a/sigi/apps/diagnosticos/migrations/0002_auto_20160719_0920.py b/sigi/apps/diagnosticos/migrations/0002_auto_20160719_0920.py index 8587818..6590dc1 100644 --- a/sigi/apps/diagnosticos/migrations/0002_auto_20160719_0920.py +++ b/sigi/apps/diagnosticos/migrations/0002_auto_20160719_0920.py @@ -7,7 +7,6 @@ import eav.models class Migration(migrations.Migration): - dependencies = [ ("diagnosticos", "0001_initial"), ] diff --git a/sigi/apps/diagnosticos/migrations/0002_auto_20170407_1024.py b/sigi/apps/diagnosticos/migrations/0002_auto_20170407_1024.py index 8587818..6590dc1 100644 --- a/sigi/apps/diagnosticos/migrations/0002_auto_20170407_1024.py +++ b/sigi/apps/diagnosticos/migrations/0002_auto_20170407_1024.py @@ -7,7 +7,6 @@ import eav.models class Migration(migrations.Migration): - dependencies = [ ("diagnosticos", "0001_initial"), ] diff --git a/sigi/apps/diagnosticos/migrations/0003_auto_20201101_2240.py b/sigi/apps/diagnosticos/migrations/0003_auto_20201101_2240.py index fcd3324..2b11d9f 100644 --- a/sigi/apps/diagnosticos/migrations/0003_auto_20201101_2240.py +++ b/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"), ] diff --git a/sigi/apps/diagnosticos/migrations/0004_auto_20210406_1945.py b/sigi/apps/diagnosticos/migrations/0004_auto_20210406_1945.py index a64f16f..97a0d96 100644 --- a/sigi/apps/diagnosticos/migrations/0004_auto_20210406_1945.py +++ b/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"), diff --git a/sigi/apps/diagnosticos/migrations/0005_auto_20210416_0841.py b/sigi/apps/diagnosticos/migrations/0005_auto_20210416_0841.py index b295a3b..2391bca 100644 --- a/sigi/apps/diagnosticos/migrations/0005_auto_20210416_0841.py +++ b/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"), ] diff --git a/sigi/apps/diagnosticos/migrations/0006_merge.py b/sigi/apps/diagnosticos/migrations/0006_merge.py index bc36184..f0a8ae5 100644 --- a/sigi/apps/diagnosticos/migrations/0006_merge.py +++ b/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"), diff --git a/sigi/apps/diagnosticos/views.py b/sigi/apps/diagnosticos/views.py index 559dd7d..7207598 100644 --- a/sigi/apps/diagnosticos/views.py +++ b/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 = [ { diff --git a/sigi/apps/diagnosticos/widgets.py b/sigi/apps/diagnosticos/widgets.py index bdbbf12..2a793a9 100644 --- a/sigi/apps/diagnosticos/widgets.py +++ b/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 diff --git a/sigi/apps/eventos/admin.py b/sigi/apps/eventos/admin.py index 33300f3..35cf5ef 100644 --- a/sigi/apps/eventos/admin.py +++ b/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,16 +358,23 @@ 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( cronograma[0].data_prevista_inicio, cronograma[0].data_inicio or cronograma[0].data_prevista_inicio, ) 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( diff --git a/sigi/apps/eventos/migrations/0001_initial.py b/sigi/apps/eventos/migrations/0001_initial.py index 2b72638..78bfc2b 100644 --- a/sigi/apps/eventos/migrations/0001_initial.py +++ b/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",), diff --git a/sigi/apps/eventos/migrations/0002_auto_20151016_1449.py b/sigi/apps/eventos/migrations/0002_auto_20151016_1449.py index 3edb1c8..b388952 100644 --- a/sigi/apps/eventos/migrations/0002_auto_20151016_1449.py +++ b/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"), ] diff --git a/sigi/apps/eventos/migrations/0003_auto_20151104_0810.py b/sigi/apps/eventos/migrations/0003_auto_20151104_0810.py index d1565c0..5169ea1 100644 --- a/sigi/apps/eventos/migrations/0003_auto_20151104_0810.py +++ b/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"), ] diff --git a/sigi/apps/eventos/migrations/0004_auto_20160719_0920.py b/sigi/apps/eventos/migrations/0004_auto_20160719_0920.py index 936c35e..9d56f34 100644 --- a/sigi/apps/eventos/migrations/0004_auto_20160719_0920.py +++ b/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"), ] diff --git a/sigi/apps/eventos/migrations/0004_remove_evento_curso_moodle_id.py b/sigi/apps/eventos/migrations/0004_remove_evento_curso_moodle_id.py index 936c35e..9d56f34 100644 --- a/sigi/apps/eventos/migrations/0004_remove_evento_curso_moodle_id.py +++ b/sigi/apps/eventos/migrations/0004_remove_evento_curso_moodle_id.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0003_auto_20151104_0810"), ] diff --git a/sigi/apps/eventos/migrations/0005_auto_20210406_1945.py b/sigi/apps/eventos/migrations/0005_auto_20210406_1945.py index e996a4f..80e94f7 100644 --- a/sigi/apps/eventos/migrations/0005_auto_20210406_1945.py +++ b/sigi/apps/eventos/migrations/0005_auto_20210406_1945.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0004_remove_evento_curso_moodle_id"), ("casas", "0014_auto_20210406_1945"), diff --git a/sigi/apps/eventos/migrations/0006_auto_20210416_0841.py b/sigi/apps/eventos/migrations/0006_auto_20210416_0841.py index 8eca59b..846c2e3 100644 --- a/sigi/apps/eventos/migrations/0006_auto_20210416_0841.py +++ b/sigi/apps/eventos/migrations/0006_auto_20210416_0841.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("eventos", "0005_auto_20210406_1945"), ] diff --git a/sigi/apps/eventos/migrations/0007_auto_20210417_0744.py b/sigi/apps/eventos/migrations/0007_auto_20210417_0744.py index 2256ac3..4a6edc7 100644 --- a/sigi/apps/eventos/migrations/0007_auto_20210417_0744.py +++ b/sigi/apps/eventos/migrations/0007_auto_20210417_0744.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0006_auto_20210416_0841"), ] diff --git a/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py b/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py index e691516..4f805b2 100644 --- a/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py +++ b/sigi/apps/eventos/migrations/0008_auto_20211104_1253.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0007_auto_20210417_0744"), ] diff --git a/sigi/apps/eventos/migrations/0009_tipoevento_categoria.py b/sigi/apps/eventos/migrations/0009_tipoevento_categoria.py index 303a829..b17a568 100644 --- a/sigi/apps/eventos/migrations/0009_tipoevento_categoria.py +++ b/sigi/apps/eventos/migrations/0009_tipoevento_categoria.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0008_auto_20211104_1253"), ] diff --git a/sigi/apps/eventos/migrations/0010_modulo.py b/sigi/apps/eventos/migrations/0010_modulo.py index 29a446a..72775d0 100644 --- a/sigi/apps/eventos/migrations/0010_modulo.py +++ b/sigi/apps/eventos/migrations/0010_modulo.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servidores", "0007_auto_20210430_0735"), ("eventos", "0009_tipoevento_categoria"), @@ -25,7 +24,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"), + ), ( "descricao", models.TextField( diff --git a/sigi/apps/eventos/migrations/0011_auto_20211117_0633.py b/sigi/apps/eventos/migrations/0011_auto_20211117_0633.py index d9295bd..ebc105a 100644 --- a/sigi/apps/eventos/migrations/0011_auto_20211117_0633.py +++ b/sigi/apps/eventos/migrations/0011_auto_20211117_0633.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0010_modulo"), ] diff --git a/sigi/apps/eventos/migrations/0012_auto_20211117_0657.py b/sigi/apps/eventos/migrations/0012_auto_20211117_0657.py index a52f1d8..6d77dcc 100644 --- a/sigi/apps/eventos/migrations/0012_auto_20211117_0657.py +++ b/sigi/apps/eventos/migrations/0012_auto_20211117_0657.py @@ -20,7 +20,6 @@ def atualiza_participantes(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("eventos", "0011_auto_20211117_0633"), ] diff --git a/sigi/apps/eventos/migrations/0013_modelodeclaracao.py b/sigi/apps/eventos/migrations/0013_modelodeclaracao.py index 8099703..25b27d6 100644 --- a/sigi/apps/eventos/migrations/0013_modelodeclaracao.py +++ b/sigi/apps/eventos/migrations/0013_modelodeclaracao.py @@ -6,7 +6,6 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ ("eventos", "0012_auto_20211117_0657"), ] diff --git a/sigi/apps/eventos/migrations/0014_auto_20211124_0736.py b/sigi/apps/eventos/migrations/0014_auto_20211124_0736.py index 6e73b87..cefc7dc 100644 --- a/sigi/apps/eventos/migrations/0014_auto_20211124_0736.py +++ b/sigi/apps/eventos/migrations/0014_auto_20211124_0736.py @@ -6,7 +6,6 @@ import tinymce.models class Migration(migrations.Migration): - dependencies = [ ("eventos", "0013_modelodeclaracao"), ] diff --git a/sigi/apps/eventos/migrations/0015_anexo.py b/sigi/apps/eventos/migrations/0015_anexo.py index 19a4418..8df9fa2 100644 --- a/sigi/apps/eventos/migrations/0015_anexo.py +++ b/sigi/apps/eventos/migrations/0015_anexo.py @@ -6,7 +6,6 @@ import datetime class Migration(migrations.Migration): - dependencies = [ ("eventos", "0014_auto_20211124_0736"), ] diff --git a/sigi/apps/eventos/migrations/0016_merge.py b/sigi/apps/eventos/migrations/0016_merge.py index 3e3a37b..0302334 100644 --- a/sigi/apps/eventos/migrations/0016_merge.py +++ b/sigi/apps/eventos/migrations/0016_merge.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0004_auto_20160719_0920"), ("eventos", "0015_anexo"), diff --git a/sigi/apps/eventos/migrations/0017_alter_anexo_arquivo_alter_anexo_descricao_and_more.py b/sigi/apps/eventos/migrations/0017_alter_anexo_arquivo_alter_anexo_descricao_and_more.py index 1c9c6eb..e83c6fa 100644 --- a/sigi/apps/eventos/migrations/0017_alter_anexo_arquivo_alter_anexo_descricao_and_more.py +++ b/sigi/apps/eventos/migrations/0017_alter_anexo_arquivo_alter_anexo_descricao_and_more.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servidores", "0008_alter_servico_id_alter_servidor_foto_and_more"), ("eventos", "0016_merge"), diff --git a/sigi/apps/eventos/migrations/0018_evento_data_pedido_evento_num_processo_and_more.py b/sigi/apps/eventos/migrations/0018_evento_data_pedido_evento_num_processo_and_more.py index da5f690..5e1fe3f 100644 --- a/sigi/apps/eventos/migrations/0018_evento_data_pedido_evento_num_processo_and_more.py +++ b/sigi/apps/eventos/migrations/0018_evento_data_pedido_evento_num_processo_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("eventos", "0017_alter_anexo_arquivo_alter_anexo_descricao_and_more"), ] diff --git a/sigi/apps/eventos/migrations/0019_alter_evento_status.py b/sigi/apps/eventos/migrations/0019_alter_evento_status.py index 9eb20ab..82dff82 100644 --- a/sigi/apps/eventos/migrations/0019_alter_evento_status.py +++ b/sigi/apps/eventos/migrations/0019_alter_evento_status.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("eventos", "0018_evento_data_pedido_evento_num_processo_and_more"), ] diff --git a/sigi/apps/eventos/migrations/0020_anexo_convite.py b/sigi/apps/eventos/migrations/0020_anexo_convite.py index 0d8bbce..2da4e4a 100644 --- a/sigi/apps/eventos/migrations/0020_anexo_convite.py +++ b/sigi/apps/eventos/migrations/0020_anexo_convite.py @@ -5,15 +5,19 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ - ('eventos', '0019_alter_evento_status'), + ("eventos", "0019_alter_evento_status"), ] operations = [ migrations.AddField( - model_name='anexo', - name='convite', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='eventos.convite'), + model_name="anexo", + name="convite", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="eventos.convite", + ), ), ] diff --git a/sigi/apps/eventos/migrations/0021_equipe_assina_oficio.py b/sigi/apps/eventos/migrations/0021_equipe_assina_oficio.py index 580a2e4..a03a612 100644 --- a/sigi/apps/eventos/migrations/0021_equipe_assina_oficio.py +++ b/sigi/apps/eventos/migrations/0021_equipe_assina_oficio.py @@ -4,15 +4,16 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('eventos', '0020_anexo_convite'), + ("eventos", "0020_anexo_convite"), ] operations = [ migrations.AddField( - model_name='equipe', - name='assina_oficio', - field=models.BooleanField(default=False, verbose_name='Assina ofício de comparecimento'), + model_name="equipe", + name="assina_oficio", + field=models.BooleanField( + default=False, verbose_name="Assina ofício de comparecimento" + ), ), ] diff --git a/sigi/apps/eventos/migrations/0022_alter_anexo_data_pub.py b/sigi/apps/eventos/migrations/0022_alter_anexo_data_pub.py index 4364d4f..db612d3 100644 --- a/sigi/apps/eventos/migrations/0022_alter_anexo_data_pub.py +++ b/sigi/apps/eventos/migrations/0022_alter_anexo_data_pub.py @@ -5,15 +5,17 @@ import django.utils.timezone class Migration(migrations.Migration): - dependencies = [ - ('eventos', '0021_equipe_assina_oficio'), + ("eventos", "0021_equipe_assina_oficio"), ] 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", + ), ), ] diff --git a/sigi/apps/eventos/migrations/0023_cronograma_checklist.py b/sigi/apps/eventos/migrations/0023_cronograma_checklist.py index 4523a17..7e753ab 100644 --- a/sigi/apps/eventos/migrations/0023_cronograma_checklist.py +++ b/sigi/apps/eventos/migrations/0023_cronograma_checklist.py @@ -5,54 +5,217 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ - ('eventos', '0022_alter_anexo_data_pub'), + ("eventos", "0022_alter_anexo_data_pub"), ] operations = [ migrations.CreateModel( - name='Cronograma', + name="Cronograma", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('etapa', models.CharField(max_length=10, verbose_name='sigla da etapa')), - ('nome', models.CharField(max_length=100, verbose_name='nome da etapa')), - ('descricao', models.TextField(help_text='Descrição detalhada das atividades realizadas na etapa', verbose_name='descrição da etapa')), - ('duracao', models.PositiveBigIntegerField(verbose_name='duração (em dias)')), - ('data_prevista_inicio', models.DateField(blank=True, null=True, verbose_name='data prevista de início')), - ('data_prevista_termino', models.DateField(blank=True, null=True, verbose_name='data prevista de término')), - ('data_inicio', models.DateField(blank=True, null=True, verbose_name='data de início')), - ('data_termino', models.DateField(blank=True, null=True, verbose_name='data de término')), - ('dependencia', models.CharField(blank=True, help_text='Sigla da etapa que precisa ser concluída para que esta seja iniciada', max_length=200, verbose_name='depende da etapa')), - ('responsaveis', models.TextField(blank=True, help_text='Pessoas, setores, órgãos.', verbose_name='responsáveis pela tarefa')), - ('comunicar_inicio', models.TextField(blank=True, help_text='Lista de pessoas/órgãos para comunicar quando a tarefa for iniciada. Coloque um por linha.', verbose_name='comunicar inicio para')), - ('comunicar_termino', models.TextField(blank=True, help_text='Lista de pessoas/órgãos para comunicar quando a tarefa for concluída. Coloque um por linha.', verbose_name='comunicar término para')), - ('recursos', models.TextField(help_text='Lista de recursos necessários para desenvolver a tarefa', verbose_name='recursos necessários')), - ('evento', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eventos.evento')), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "etapa", + models.CharField( + max_length=10, verbose_name="sigla da etapa" + ), + ), + ( + "nome", + models.CharField( + max_length=100, verbose_name="nome da etapa" + ), + ), + ( + "descricao", + models.TextField( + help_text="Descrição detalhada das atividades realizadas na etapa", + verbose_name="descrição da etapa", + ), + ), + ( + "duracao", + models.PositiveBigIntegerField( + verbose_name="duração (em dias)" + ), + ), + ( + "data_prevista_inicio", + models.DateField( + blank=True, + null=True, + verbose_name="data prevista de início", + ), + ), + ( + "data_prevista_termino", + models.DateField( + blank=True, + null=True, + verbose_name="data prevista de término", + ), + ), + ( + "data_inicio", + models.DateField( + blank=True, null=True, verbose_name="data de início" + ), + ), + ( + "data_termino", + models.DateField( + blank=True, null=True, verbose_name="data de término" + ), + ), + ( + "dependencia", + models.CharField( + blank=True, + help_text="Sigla da etapa que precisa ser concluída para que esta seja iniciada", + max_length=200, + verbose_name="depende da etapa", + ), + ), + ( + "responsaveis", + models.TextField( + blank=True, + help_text="Pessoas, setores, órgãos.", + verbose_name="responsáveis pela tarefa", + ), + ), + ( + "comunicar_inicio", + models.TextField( + blank=True, + help_text="Lista de pessoas/órgãos para comunicar quando a tarefa for iniciada. Coloque um por linha.", + verbose_name="comunicar inicio para", + ), + ), + ( + "comunicar_termino", + models.TextField( + blank=True, + help_text="Lista de pessoas/órgãos para comunicar quando a tarefa for concluída. Coloque um por linha.", + verbose_name="comunicar término para", + ), + ), + ( + "recursos", + models.TextField( + help_text="Lista de recursos necessários para desenvolver a tarefa", + verbose_name="recursos necessários", + ), + ), + ( + "evento", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="eventos.evento", + ), + ), ], options={ - 'verbose_name': 'cronograma', - 'verbose_name_plural': 'cronogramas', + "verbose_name": "cronograma", + "verbose_name_plural": "cronogramas", }, ), migrations.CreateModel( - name='Checklist', + name="Checklist", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('etapa', models.CharField(max_length=10, verbose_name='sigla da etapa')), - ('nome', models.CharField(max_length=100, verbose_name='nome da etapa')), - ('descricao', models.TextField(help_text='Descrição detalhada das atividades realizadas na etapa', verbose_name='descrição da etapa')), - ('duracao', models.PositiveBigIntegerField(verbose_name='duração (em dias)')), - ('dependencia', models.CharField(blank=True, help_text='Siglas das etapas que precisam ser concluídas para que esta seja iniciada. Separe cada uma com um espaço.', max_length=200, verbose_name='depende da etapa')), - ('responsaveis', models.TextField(blank=True, help_text='Pessoas, setores, órgãos.', verbose_name='responsáveis pela tarefa')), - ('comunicar_inicio', models.TextField(blank=True, help_text='Lista de e-mails para comunicar quando a tarefa for iniciada', verbose_name='comunicar inicio para')), - ('comunicar_termino', models.TextField(blank=True, help_text='Lista de e-mails para comunicar quando a tarefa for concluída', verbose_name='comunicar término para')), - ('recursos', models.TextField(help_text='Lista de recursos necessários para desenvolver a tarefa', verbose_name='recursos necessários')), - ('tipo_evento', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='eventos.tipoevento')), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "etapa", + models.CharField( + max_length=10, verbose_name="sigla da etapa" + ), + ), + ( + "nome", + models.CharField( + max_length=100, verbose_name="nome da etapa" + ), + ), + ( + "descricao", + models.TextField( + help_text="Descrição detalhada das atividades realizadas na etapa", + verbose_name="descrição da etapa", + ), + ), + ( + "duracao", + models.PositiveBigIntegerField( + verbose_name="duração (em dias)" + ), + ), + ( + "dependencia", + models.CharField( + blank=True, + help_text="Siglas das etapas que precisam ser concluídas para que esta seja iniciada. Separe cada uma com um espaço.", + max_length=200, + verbose_name="depende da etapa", + ), + ), + ( + "responsaveis", + models.TextField( + blank=True, + help_text="Pessoas, setores, órgãos.", + verbose_name="responsáveis pela tarefa", + ), + ), + ( + "comunicar_inicio", + models.TextField( + blank=True, + help_text="Lista de e-mails para comunicar quando a tarefa for iniciada", + verbose_name="comunicar inicio para", + ), + ), + ( + "comunicar_termino", + models.TextField( + blank=True, + help_text="Lista de e-mails para comunicar quando a tarefa for concluída", + verbose_name="comunicar término para", + ), + ), + ( + "recursos", + models.TextField( + help_text="Lista de recursos necessários para desenvolver a tarefa", + verbose_name="recursos necessários", + ), + ), + ( + "tipo_evento", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="eventos.tipoevento", + ), + ), ], options={ - 'verbose_name': 'checklist', - 'verbose_name_plural': 'checklists', + "verbose_name": "checklist", + "verbose_name_plural": "checklists", }, ), ] diff --git a/sigi/apps/eventos/migrations/0024_evento_banner_evento_contato_evento_link_inscricao_and_more.py b/sigi/apps/eventos/migrations/0024_evento_banner_evento_contato_evento_link_inscricao_and_more.py index 5df42c0..0f9fedf 100644 --- a/sigi/apps/eventos/migrations/0024_evento_banner_evento_contato_evento_link_inscricao_and_more.py +++ b/sigi/apps/eventos/migrations/0024_evento_banner_evento_contato_evento_link_inscricao_and_more.py @@ -4,35 +4,47 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('eventos', '0023_cronograma_checklist'), + ("eventos", "0023_cronograma_checklist"), ] operations = [ migrations.AddField( - model_name='evento', - name='banner', - field=models.ImageField(blank=True, null=True, upload_to='', verbose_name='banner do evento'), + model_name="evento", + name="banner", + field=models.ImageField( + blank=True, + null=True, + upload_to="", + verbose_name="banner do evento", + ), ), migrations.AddField( - model_name='evento', - name='contato', - field=models.CharField(blank=True, max_length=100, verbose_name='contato'), + model_name="evento", + name="contato", + field=models.CharField( + blank=True, max_length=100, verbose_name="contato" + ), ), migrations.AddField( - model_name='evento', - name='link_inscricao', - field=models.URLField(blank=True, verbose_name='link de inscrição'), + model_name="evento", + name="link_inscricao", + field=models.URLField( + blank=True, verbose_name="link de inscrição" + ), ), migrations.AddField( - model_name='evento', - name='publicar', - field=models.BooleanField(default=False, verbose_name='publicar no site'), + model_name="evento", + name="publicar", + field=models.BooleanField( + default=False, verbose_name="publicar no site" + ), ), migrations.AddField( - model_name='evento', - name='telefone', - field=models.CharField(blank=True, max_length=30, verbose_name='tefone de contato'), + model_name="evento", + name="telefone", + field=models.CharField( + blank=True, max_length=30, verbose_name="tefone de contato" + ), ), ] diff --git a/sigi/apps/eventos/migrations/0025_evento_turma.py b/sigi/apps/eventos/migrations/0025_evento_turma.py index a97c3a7..db9f41f 100644 --- a/sigi/apps/eventos/migrations/0025_evento_turma.py +++ b/sigi/apps/eventos/migrations/0025_evento_turma.py @@ -4,15 +4,19 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ("eventos", "0024_evento_banner_evento_contato_evento_link_inscricao_and_more"), + ( + "eventos", + "0024_evento_banner_evento_contato_evento_link_inscricao_and_more", + ), ] operations = [ migrations.AddField( model_name="evento", name="turma", - field=models.CharField(blank=True, max_length=100, verbose_name="turma"), + field=models.CharField( + blank=True, max_length=100, verbose_name="turma" + ), ), ] diff --git a/sigi/apps/eventos/migrations/0026_preenche_turma.py b/sigi/apps/eventos/migrations/0026_preenche_turma.py index 422af5e..ef52ee2 100644 --- a/sigi/apps/eventos/migrations/0026_preenche_turma.py +++ b/sigi/apps/eventos/migrations/0026_preenche_turma.py @@ -21,7 +21,6 @@ def junta_turma(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("eventos", "0025_evento_turma"), ] diff --git a/sigi/apps/eventos/migrations/0027_tipoevento_casa_solicita.py b/sigi/apps/eventos/migrations/0027_tipoevento_casa_solicita.py index 4215a9f..8f09103 100644 --- a/sigi/apps/eventos/migrations/0027_tipoevento_casa_solicita.py +++ b/sigi/apps/eventos/migrations/0027_tipoevento_casa_solicita.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("eventos", "0026_preenche_turma"), ] diff --git a/sigi/apps/eventos/migrations/0028_evento_solicitacao.py b/sigi/apps/eventos/migrations/0028_evento_solicitacao.py index 2dfc513..feab9de 100644 --- a/sigi/apps/eventos/migrations/0028_evento_solicitacao.py +++ b/sigi/apps/eventos/migrations/0028_evento_solicitacao.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0011_alter_categoria_tipo"), ("eventos", "0027_tipoevento_casa_solicita"), diff --git a/sigi/apps/eventos/migrations/0029_alter_convite_options_remove_convite_aceite_and_more.py b/sigi/apps/eventos/migrations/0029_alter_convite_options_remove_convite_aceite_and_more.py index 3f5406c..725bc2b 100644 --- a/sigi/apps/eventos/migrations/0029_alter_convite_options_remove_convite_aceite_and_more.py +++ b/sigi/apps/eventos/migrations/0029_alter_convite_options_remove_convite_aceite_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("eventos", "0028_evento_solicitacao"), ] diff --git a/sigi/apps/eventos/migrations/0030_alter_evento_descricao_alter_tipoevento_categoria.py b/sigi/apps/eventos/migrations/0030_alter_evento_descricao_alter_tipoevento_categoria.py index ccd7f1a..9d3c9e6 100644 --- a/sigi/apps/eventos/migrations/0030_alter_evento_descricao_alter_tipoevento_categoria.py +++ b/sigi/apps/eventos/migrations/0030_alter_evento_descricao_alter_tipoevento_categoria.py @@ -5,7 +5,10 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ("eventos", "0029_alter_convite_options_remove_convite_aceite_and_more"), + ( + "eventos", + "0029_alter_convite_options_remove_convite_aceite_and_more", + ), ] operations = [ diff --git a/sigi/apps/eventos/migrations/0035_alter_evento_options.py b/sigi/apps/eventos/migrations/0035_alter_evento_options.py index eaa0145..c06cd32 100644 --- a/sigi/apps/eventos/migrations/0035_alter_evento_options.py +++ b/sigi/apps/eventos/migrations/0035_alter_evento_options.py @@ -5,7 +5,10 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ("eventos", "0034_funcao_moodle_roleid_tipoevento_moodle_categoryid_and_more"), + ( + "eventos", + "0034_funcao_moodle_roleid_tipoevento_moodle_categoryid_and_more", + ), ] operations = [ @@ -14,7 +17,10 @@ class Migration(migrations.Migration): options={ "ordering": ("-data_inicio",), "permissions": [ - ("createcourse_evento", "Can create courses in Saberes platform") + ( + "createcourse_evento", + "Can create courses in Saberes platform", + ) ], "verbose_name": "Evento", "verbose_name_plural": "Eventos", diff --git a/sigi/apps/eventos/models.py b/sigi/apps/eventos/models.py index a07c77f..f417f57 100644 --- a/sigi/apps/eventos/models.py +++ b/sigi/apps/eventos/models.py @@ -32,7 +32,9 @@ class TipoEvento(models.Model): categoria = models.CharField( _("Categoria"), max_length=1, choices=CATEGORIA_CHOICES ) - casa_solicita = models.BooleanField(_("casa pode solicitar"), default=False) + casa_solicita = models.BooleanField( + _("casa pode solicitar"), default=False + ) moodle_template_courseid = models.PositiveBigIntegerField( _("Curso protótipo"), blank=True, @@ -161,7 +163,9 @@ class Evento(models.Model): "dos participantes naquela aba." ), ) - status = models.CharField(_("Status"), max_length=1, choices=STATUS_CHOICES) + status = models.CharField( + _("Status"), max_length=1, choices=STATUS_CHOICES + ) publicar = models.BooleanField(_("publicar no site"), default=False) moodle_courseid = models.PositiveBigIntegerField( _("ID do curso"), @@ -569,7 +573,9 @@ class Cronograma(models.Model): _("data prevista de término"), blank=True, null=True ) data_inicio = models.DateField(_("data de início"), blank=True, null=True) - data_termino = models.DateField(_("data de término"), blank=True, null=True) + data_termino = models.DateField( + _("data de término"), blank=True, null=True + ) dependencia = models.CharField( _("depende da etapa"), max_length=200, diff --git a/sigi/apps/eventos/views.py b/sigi/apps/eventos/views.py index e782068..12dccf6 100644 --- a/sigi/apps/eventos/views.py +++ b/sigi/apps/eventos/views.py @@ -65,13 +65,17 @@ def calendario(request): eventos = ( Evento.objects.exclude(data_inicio=None) .exclude(data_termino=None) - .filter(data_inicio__year=ano_pesquisa, data_inicio__month=mes_pesquisa) + .filter( + data_inicio__year=ano_pesquisa, data_inicio__month=mes_pesquisa + ) ) context = {} if formato == "cal" or pdf: - semanas = calendar.Calendar().monthdatescalendar(ano_pesquisa, mes_pesquisa) + semanas = calendar.Calendar().monthdatescalendar( + ano_pesquisa, mes_pesquisa + ) for semana in semanas: for dia in semana: if dia.month == mes_pesquisa: @@ -80,7 +84,9 @@ def calendario(request): [ e for e in eventos - if e.data_inicio.day <= dia.day <= e.data_termino.day + if e.data_inicio.day + <= dia.day + <= e.data_termino.day ], ) else: @@ -124,9 +130,9 @@ class EventoListView(ListView): def get_queryset(self): queryset = super().get_queryset() - return queryset.filter(status=Evento.STATUS_CONFIRMADO, publicar=True).order_by( - "data_inicio" - ) + return queryset.filter( + status=Evento.STATUS_CONFIRMADO, publicar=True + ).order_by("data_inicio") @xframe_options_exempt def get(self, request, *args, **kwargs): @@ -152,20 +158,23 @@ def alocacao_equipe(request): if mes_pesquisa > 0: semanas = [ [s[0], s[-1]] - for s in calendar.Calendar().monthdatescalendar(ano_pesquisa, mes_pesquisa) + for s in calendar.Calendar().monthdatescalendar( + ano_pesquisa, mes_pesquisa + ) ] num_cols = len(semanas) if semana_pesquisa > 0: - dias = calendar.Calendar().monthdatescalendar(ano_pesquisa, mes_pesquisa)[ - semana_pesquisa - 1 - ] + dias = calendar.Calendar().monthdatescalendar( + ano_pesquisa, mes_pesquisa + )[semana_pesquisa - 1] num_cols = len(dias) eventos = eventos.filter( data_inicio__gte=dias[0], data_inicio__lte=dias[-1] ) else: eventos = eventos.filter( - data_inicio__gte=semanas[0][0], data_inicio__lte=semanas[-1][-1] + data_inicio__gte=semanas[0][0], + data_inicio__lte=semanas[-1][-1], ) else: eventos = eventos.filter(data_inicio__year=ano_pesquisa) @@ -227,7 +236,9 @@ def alocacao_equipe(request): linhas = [] if semana_pesquisa: - linhas = [[registro[1]] + list(registro[2].values()) for registro in dados] + linhas = [ + [registro[1]] + list(registro[2].values()) for registro in dados + ] else: for r in dados: r[2].append( @@ -277,7 +288,10 @@ def alocacao_equipe(request): else: cabecalho = ( [_("Servidor")] - + [_(f"de {inicio:%d/%m} a {fim:%d/%m}") for inicio, fim in semanas] + + [ + _(f"de {inicio:%d/%m} a {fim:%d/%m}") + for inicio, fim in semanas + ] + ["total"] ) else: diff --git a/sigi/apps/financeiro/migrations/0001_initial.py b/sigi/apps/financeiro/migrations/0001_initial.py index 4c77017..2d2b479 100644 --- a/sigi/apps/financeiro/migrations/0001_initial.py +++ b/sigi/apps/financeiro/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("convenios", "0001_initial"), ] diff --git a/sigi/apps/home/migrations/0001_initial.py b/sigi/apps/home/migrations/0001_initial.py index 2717e49..825a21b 100644 --- a/sigi/apps/home/migrations/0001_initial.py +++ b/sigi/apps/home/migrations/0001_initial.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - initial = True dependencies = [ @@ -15,39 +14,127 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name='Cards', + name="Cards", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('codigo', models.CharField(max_length=20, verbose_name='código')), - ('tipo', models.CharField(choices=[('T', 'Tabela de dados'), ('C', 'Gráfico')], max_length=1, verbose_name='tipo')), - ('nome_url', models.CharField(max_length=30, verbose_name='nome da URL de dados')), - ('query_string', models.CharField(blank=True, max_length=100, verbose_name='query string')), - ('link_acao', models.BooleanField(default=False, verbose_name='possui link de ação')), - ('titulo', models.CharField(max_length=100, verbose_name='título')), - ('descricao', models.TextField(verbose_name='descrição')), - ('categoria', models.CharField(default='Geral', max_length=40, verbose_name='categoria')), - ('ordem', models.PositiveSmallIntegerField(default=0, verbose_name='posição na categoria')), - ('default', models.BooleanField(default=False, help_text='Indica se este card deve ser mostrado para usuários anônimos ou que não personalizaram seu dashboard', verbose_name='card padrão')), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "codigo", + models.CharField(max_length=20, verbose_name="código"), + ), + ( + "tipo", + models.CharField( + choices=[("T", "Tabela de dados"), ("C", "Gráfico")], + max_length=1, + verbose_name="tipo", + ), + ), + ( + "nome_url", + models.CharField( + max_length=30, verbose_name="nome da URL de dados" + ), + ), + ( + "query_string", + models.CharField( + blank=True, max_length=100, verbose_name="query string" + ), + ), + ( + "link_acao", + models.BooleanField( + default=False, verbose_name="possui link de ação" + ), + ), + ( + "titulo", + models.CharField(max_length=100, verbose_name="título"), + ), + ("descricao", models.TextField(verbose_name="descrição")), + ( + "categoria", + models.CharField( + default="Geral", + max_length=40, + verbose_name="categoria", + ), + ), + ( + "ordem", + models.PositiveSmallIntegerField( + default=0, verbose_name="posição na categoria" + ), + ), + ( + "default", + models.BooleanField( + default=False, + help_text="Indica se este card deve ser mostrado para usuários anônimos ou que não personalizaram seu dashboard", + verbose_name="card padrão", + ), + ), ], options={ - 'verbose_name': 'card', - 'verbose_name_plural': 'cards', - 'ordering': ('categoria', 'ordem', 'titulo'), + "verbose_name": "card", + "verbose_name_plural": "cards", + "ordering": ("categoria", "ordem", "titulo"), }, ), migrations.CreateModel( - name='Dashboard', + name="Dashboard", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('categoria', models.CharField(blank=True, help_text='Deixando em branco será utilizada a categoria padrão do card', max_length=40, verbose_name='categoria personalizada')), - ('ordem', models.PositiveSmallIntegerField(default=0, verbose_name='posição na categoria')), - ('card', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='home.cards')), - ('usuario', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "categoria", + models.CharField( + blank=True, + help_text="Deixando em branco será utilizada a categoria padrão do card", + max_length=40, + verbose_name="categoria personalizada", + ), + ), + ( + "ordem", + models.PositiveSmallIntegerField( + default=0, verbose_name="posição na categoria" + ), + ), + ( + "card", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="home.cards", + ), + ), + ( + "usuario", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ - 'verbose_name': 'dashboard', - 'verbose_name_plural': 'dashboards', - 'ordering': ('usuario', 'categoria', 'ordem'), + "verbose_name": "dashboard", + "verbose_name_plural": "dashboards", + "ordering": ("usuario", "categoria", "ordem"), }, ), ] diff --git a/sigi/apps/home/views.py b/sigi/apps/home/views.py index 38bde96..3dcfaee 100644 --- a/sigi/apps/home/views.py +++ b/sigi/apps/home/views.py @@ -126,7 +126,8 @@ class HomeView(LoginRequiredMixin, TemplateView): "id", self.request.session.get("casa_id", None) ) casas = { - c.id: c for c in Orgao.objects.filter(funcionario__email=user.email) + c.id: c + for c in Orgao.objects.filter(funcionario__email=user.email) } if casa_id and int(casa_id) in casas: casa = casas[int(casa_id)] @@ -172,7 +173,9 @@ def openmap(request): for s, n in UnidadeFederativa.REGIAO_CHOICES ] context["pre_tipos_orgao"] = request.GET.getlist("tipo_orgao", None) - context["pre_tipos_servico"] = request.GET.getlist("tipo_servico", None) + context["pre_tipos_servico"] = request.GET.getlist( + "tipo_servico", None + ) context["pre_tipos_convenio"] = request.GET.getlist( "tipo_convenio", None ) @@ -616,7 +619,8 @@ def chart_seit(request): }, "data": { "labels": [ - f"{mes: %m/%Y}" for mes in reversed(tabela_resumo_seit["meses"]) + f"{mes: %m/%Y}" + for mes in reversed(tabela_resumo_seit["meses"]) ], "datasets": [ { @@ -737,7 +741,8 @@ def chart_atualizacao_servicos(request): "type": "bar", "label": ts.sigla, "data": [ - getattr(ts, slugify(label)) for label, *__ in intervalos + getattr(ts, slugify(label)) + for label, *__ in intervalos ], "backgroundColor": getcolor(ts.nome), } @@ -1090,7 +1095,9 @@ def report_sem_convenio(request): if fmt == "csv": response = HttpResponse(content_type="text/csv") - response["Content-Disposition"] = f"attachment; filename={ titulo }.csv" + response[ + "Content-Disposition" + ] = f"attachment; filename={ titulo }.csv" writer = csv.writer(response) writer.writerow([titulo]) writer.writerow([""]) @@ -1146,8 +1153,12 @@ def report_sem_convenio(request): def busca_informacoes_camara(tipos=["CM"], label_tipo=_("Câmaras Municipais")): camaras = Orgao.objects.filter(tipo__sigla__in=tipos) - convenios = Convenio.objects.filter(casa_legislativa__tipo__sigla__in=tipos) - convenios_vigentes = convenios.exclude(data_retorno_assinatura=None).filter( + convenios = Convenio.objects.filter( + casa_legislativa__tipo__sigla__in=tipos + ) + convenios_vigentes = convenios.exclude( + data_retorno_assinatura=None + ).filter( Q(data_termino_vigencia__gte=timezone.localdate()) | Q(data_termino_vigencia=None) ) @@ -1377,7 +1388,9 @@ def ChartDownloadResponse(chart, chart_type, subtype=None, file_name="chart"): ) col += 1 if subtype: - workchart = workbook.add_chart({"type": chart_type, "subtype": subtype}) + workchart = workbook.add_chart( + {"type": chart_type, "subtype": subtype} + ) else: workchart = workbook.add_chart({"type": chart_type}) for name, values in intervals: diff --git a/sigi/apps/inventario/migrations/0001_initial.py b/sigi/apps/inventario/migrations/0001_initial.py index 8e1486b..fbeca26 100644 --- a/sigi/apps/inventario/migrations/0001_initial.py +++ b/sigi/apps/inventario/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("casas", "0001_initial"), ] diff --git a/sigi/apps/inventario/migrations/0002_auto_20210406_1945.py b/sigi/apps/inventario/migrations/0002_auto_20210406_1945.py index 4c3e709..bcb13f0 100644 --- a/sigi/apps/inventario/migrations/0002_auto_20210406_1945.py +++ b/sigi/apps/inventario/migrations/0002_auto_20210406_1945.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("inventario", "0001_initial"), ("casas", "0014_auto_20210406_1945"), @@ -15,7 +14,9 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="bem", name="casa_legislativa", - field=models.ForeignKey(to="casas.Orgao", on_delete=models.CASCADE), + field=models.ForeignKey( + to="casas.Orgao", on_delete=models.CASCADE + ), preserve_default=True, ), ] diff --git a/sigi/apps/inventario/migrations/0003_auto_20210416_0841.py b/sigi/apps/inventario/migrations/0003_auto_20210416_0841.py index 216c664..6e9d1a7 100644 --- a/sigi/apps/inventario/migrations/0003_auto_20210416_0841.py +++ b/sigi/apps/inventario/migrations/0003_auto_20210416_0841.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("inventario", "0002_auto_20210406_1945"), ] diff --git a/sigi/apps/inventario/migrations/0004_alter_bem_id_alter_equipamento_id_and_more.py b/sigi/apps/inventario/migrations/0004_alter_bem_id_alter_equipamento_id_and_more.py index ae1ad5d..2c44ae7 100644 --- a/sigi/apps/inventario/migrations/0004_alter_bem_id_alter_equipamento_id_and_more.py +++ b/sigi/apps/inventario/migrations/0004_alter_bem_id_alter_equipamento_id_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("inventario", "0003_auto_20210416_0841"), ] diff --git a/sigi/apps/metas/migrations/0001_initial.py b/sigi/apps/metas/migrations/0001_initial.py index ed628c0..d849a87 100644 --- a/sigi/apps/metas/migrations/0001_initial.py +++ b/sigi/apps/metas/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("casas", "0001_initial"), ("convenios", "0001_initial"), @@ -32,7 +31,10 @@ class Migration(migrations.Migration): verbose_name="T\xedtulo", ), ), - ("descricao", models.TextField(verbose_name="Descri\xe7\xe3o")), + ( + "descricao", + models.TextField(verbose_name="Descri\xe7\xe3o"), + ), ( "data_inicio", models.DateField( diff --git a/sigi/apps/metas/migrations/0002_auto_20210406_1945.py b/sigi/apps/metas/migrations/0002_auto_20210406_1945.py index 35d6cbd..f25c86f 100644 --- a/sigi/apps/metas/migrations/0002_auto_20210406_1945.py +++ b/sigi/apps/metas/migrations/0002_auto_20210406_1945.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("metas", "0001_initial"), ("casas", "0014_auto_20210406_1945"), diff --git a/sigi/apps/metas/models.py b/sigi/apps/metas/models.py index 3e46027..bd8dec1 100644 --- a/sigi/apps/metas/models.py +++ b/sigi/apps/metas/models.py @@ -184,7 +184,9 @@ class PlanoDiretor(models.Model): status = models.CharField( _("Status"), max_length=1, choices=STATUS_CHOICE, default="E" ) - data_entrega = models.DateField(_("Data de entrega"), blank=True, null=True) + data_entrega = models.DateField( + _("Data de entrega"), blank=True, null=True + ) data_implantacao = models.DateField( _("Data de implantação"), blank=True, null=True ) diff --git a/sigi/apps/metas/views.py b/sigi/apps/metas/views.py index ef4f861..6962000 100644 --- a/sigi/apps/metas/views.py +++ b/sigi/apps/metas/views.py @@ -185,7 +185,9 @@ def openmap(request): "emails": ", ".join( [casa.email] + list( - casa.funcionario_set.values_list("email", flat=True) + casa.funcionario_set.values_list( + "email", flat=True + ) ) ).encode("utf8"), "contatos": ", ".join( diff --git a/sigi/apps/ocorrencias/migrations/0001_initial.py b/sigi/apps/ocorrencias/migrations/0001_initial.py index 91c25bb..30b002b 100644 --- a/sigi/apps/ocorrencias/migrations/0001_initial.py +++ b/sigi/apps/ocorrencias/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("casas", "0001_initial"), ("servidores", "0001_initial"), @@ -35,7 +34,8 @@ class Migration(migrations.Migration): ( "descricao", models.CharField( - max_length="70", verbose_name="descri\xe7\xe3o do anexo" + max_length="70", + verbose_name="descri\xe7\xe3o do anexo", ), ), ( diff --git a/sigi/apps/ocorrencias/migrations/0002_auto_20160308_0828.py b/sigi/apps/ocorrencias/migrations/0002_auto_20160308_0828.py index 765de5d..e94dda4 100644 --- a/sigi/apps/ocorrencias/migrations/0002_auto_20160308_0828.py +++ b/sigi/apps/ocorrencias/migrations/0002_auto_20160308_0828.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0001_initial"), ] diff --git a/sigi/apps/ocorrencias/migrations/0003_auto_20210406_1945.py b/sigi/apps/ocorrencias/migrations/0003_auto_20210406_1945.py index 66020f1..b44764a 100644 --- a/sigi/apps/ocorrencias/migrations/0003_auto_20210406_1945.py +++ b/sigi/apps/ocorrencias/migrations/0003_auto_20210406_1945.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0002_auto_20160308_0828"), ("casas", "0014_auto_20210406_1945"), diff --git a/sigi/apps/ocorrencias/migrations/0004_auto_20210416_0841.py b/sigi/apps/ocorrencias/migrations/0004_auto_20210416_0841.py index 82e97af..e522c33 100644 --- a/sigi/apps/ocorrencias/migrations/0004_auto_20210416_0841.py +++ b/sigi/apps/ocorrencias/migrations/0004_auto_20210416_0841.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0003_auto_20210406_1945"), ] diff --git a/sigi/apps/ocorrencias/migrations/0005_auto_20210611_0946.py b/sigi/apps/ocorrencias/migrations/0005_auto_20210611_0946.py index 64dcb3b..5514183 100644 --- a/sigi/apps/ocorrencias/migrations/0005_auto_20210611_0946.py +++ b/sigi/apps/ocorrencias/migrations/0005_auto_20210611_0946.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0004_auto_20210416_0841"), ] diff --git a/sigi/apps/ocorrencias/migrations/0006_alter_anexo_arquivo_alter_anexo_descricao_and_more.py b/sigi/apps/ocorrencias/migrations/0006_alter_anexo_arquivo_alter_anexo_descricao_and_more.py index 67bd3a8..27d244b 100644 --- a/sigi/apps/ocorrencias/migrations/0006_alter_anexo_arquivo_alter_anexo_descricao_and_more.py +++ b/sigi/apps/ocorrencias/migrations/0006_alter_anexo_arquivo_alter_anexo_descricao_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0005_auto_20210611_0946"), ] diff --git a/sigi/apps/ocorrencias/migrations/0007_remove_comentario_encaminhar_setor_and_more.py b/sigi/apps/ocorrencias/migrations/0007_remove_comentario_encaminhar_setor_and_more.py index 53f4876..53561cb 100644 --- a/sigi/apps/ocorrencias/migrations/0007_remove_comentario_encaminhar_setor_and_more.py +++ b/sigi/apps/ocorrencias/migrations/0007_remove_comentario_encaminhar_setor_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ( "ocorrencias", diff --git a/sigi/apps/ocorrencias/migrations/0008_remove_categoria_setor_responsavel.py b/sigi/apps/ocorrencias/migrations/0008_remove_categoria_setor_responsavel.py index 359c089..c108637 100644 --- a/sigi/apps/ocorrencias/migrations/0008_remove_categoria_setor_responsavel.py +++ b/sigi/apps/ocorrencias/migrations/0008_remove_categoria_setor_responsavel.py @@ -4,7 +4,6 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0007_remove_comentario_encaminhar_setor_and_more"), ] diff --git a/sigi/apps/ocorrencias/migrations/0009_alter_comentario_options_categoria_projeto_and_more.py b/sigi/apps/ocorrencias/migrations/0009_alter_comentario_options_categoria_projeto_and_more.py index 7a10f0c..2f7a37c 100644 --- a/sigi/apps/ocorrencias/migrations/0009_alter_comentario_options_categoria_projeto_and_more.py +++ b/sigi/apps/ocorrencias/migrations/0009_alter_comentario_options_categoria_projeto_and_more.py @@ -6,55 +6,99 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ - ('convenios', '0031_alter_projeto_modelo_minuta_and_more'), - ('ocorrencias', '0008_remove_categoria_setor_responsavel'), + ("convenios", "0031_alter_projeto_modelo_minuta_and_more"), + ("ocorrencias", "0008_remove_categoria_setor_responsavel"), ] operations = [ migrations.AlterModelOptions( - name='comentario', - options={'ordering': ['-data_criacao'], 'verbose_name': 'comentário', 'verbose_name_plural': 'comentários'}, + name="comentario", + options={ + "ordering": ["-data_criacao"], + "verbose_name": "comentário", + "verbose_name_plural": "comentários", + }, ), migrations.AddField( - model_name='categoria', - name='projeto', - field=models.ForeignKey(blank=True, limit_choices_to=models.Q(models.Q(('texto_oficio', ''), _negated=True), models.Q(('modelo_minuta', ''), _negated=True)), null=True, on_delete=django.db.models.deletion.PROTECT, to='convenios.projeto', verbose_name='projeto'), + model_name="categoria", + name="projeto", + field=models.ForeignKey( + blank=True, + limit_choices_to=models.Q( + models.Q(("texto_oficio", ""), _negated=True), + models.Q(("modelo_minuta", ""), _negated=True), + ), + null=True, + on_delete=django.db.models.deletion.PROTECT, + to="convenios.projeto", + verbose_name="projeto", + ), ), migrations.AddField( - model_name='categoria', - name='tipo', - field=models.CharField(choices=[('C', 'Solicitação de convênio (ACT)'), ('O', 'Outras')], default='O', max_length=1, verbose_name='Tipo de solicitação'), + model_name="categoria", + name="tipo", + field=models.CharField( + choices=[ + ("C", "Solicitação de convênio (ACT)"), + ("O", "Outras"), + ], + default="O", + max_length=1, + verbose_name="Tipo de solicitação", + ), ), migrations.AddField( - model_name='comentario', - name='interno', - field=models.BooleanField(default=False, verbose_name='Comentário interno'), + model_name="comentario", + name="interno", + field=models.BooleanField( + default=False, verbose_name="Comentário interno" + ), ), migrations.AddField( - model_name='ocorrencia', - name='casa_brasao', - field=models.ImageField(blank=True, null=True, upload_to='ocorrencias/img/', verbose_name='brasão da casa'), + model_name="ocorrencia", + name="casa_brasao", + field=models.ImageField( + blank=True, + null=True, + upload_to="ocorrencias/img/", + verbose_name="brasão da casa", + ), ), migrations.AddField( - model_name='ocorrencia', - name='casa_foto', - field=models.ImageField(blank=True, editable=False, null=True, upload_to='ocorrencias/img/', verbose_name='foto da Casa'), + model_name="ocorrencia", + name="casa_foto", + field=models.ImageField( + blank=True, + editable=False, + null=True, + upload_to="ocorrencias/img/", + verbose_name="foto da Casa", + ), ), migrations.AddField( - model_name='ocorrencia', - name='infos', - field=models.JSONField(blank=True, editable=False, encoder=django.core.serializers.json.DjangoJSONEncoder, null=True, verbose_name='dados estruturados'), + model_name="ocorrencia", + name="infos", + field=models.JSONField( + blank=True, + editable=False, + encoder=django.core.serializers.json.DjangoJSONEncoder, + null=True, + verbose_name="dados estruturados", + ), ), migrations.AddField( - model_name='ocorrencia', - name='processo_sigad', - field=models.CharField(blank=True, max_length=20, verbose_name='Nº processo SIGAD'), + model_name="ocorrencia", + name="processo_sigad", + field=models.CharField( + blank=True, max_length=20, verbose_name="Nº processo SIGAD" + ), ), migrations.AddField( - model_name='tipocontato', - name='ind_site', - field=models.BooleanField(default=False, verbose_name='Contato pelo SIGI'), + model_name="tipocontato", + name="ind_site", + field=models.BooleanField( + default=False, verbose_name="Contato pelo SIGI" + ), ), ] diff --git a/sigi/apps/ocorrencias/migrations/0010_alter_ocorrencia_options_ocorrencia_interno.py b/sigi/apps/ocorrencias/migrations/0010_alter_ocorrencia_options_ocorrencia_interno.py index fb9508a..5b7512f 100644 --- a/sigi/apps/ocorrencias/migrations/0010_alter_ocorrencia_options_ocorrencia_interno.py +++ b/sigi/apps/ocorrencias/migrations/0010_alter_ocorrencia_options_ocorrencia_interno.py @@ -4,19 +4,33 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('ocorrencias', '0009_alter_comentario_options_categoria_projeto_and_more'), + ( + "ocorrencias", + "0009_alter_comentario_options_categoria_projeto_and_more", + ), ] operations = [ migrations.AlterModelOptions( - name='ocorrencia', - options={'ordering': ['prioridade', '-data_modificacao', '-data_criacao'], 'verbose_name': 'ocorrência', 'verbose_name_plural': 'ocorrências'}, + name="ocorrencia", + options={ + "ordering": [ + "prioridade", + "-data_modificacao", + "-data_criacao", + ], + "verbose_name": "ocorrência", + "verbose_name_plural": "ocorrências", + }, ), migrations.AddField( - model_name='ocorrencia', - name='interno', - field=models.BooleanField(default=True, help_text='Se marcado, essa ocorrência será visível apenas para servidores do Interlegis', verbose_name='Interno'), + model_name="ocorrencia", + name="interno", + field=models.BooleanField( + default=True, + help_text="Se marcado, essa ocorrência será visível apenas para servidores do Interlegis", + verbose_name="Interno", + ), ), ] diff --git a/sigi/apps/ocorrencias/migrations/0011_alter_categoria_tipo.py b/sigi/apps/ocorrencias/migrations/0011_alter_categoria_tipo.py index 5b29b29..80bfb94 100644 --- a/sigi/apps/ocorrencias/migrations/0011_alter_categoria_tipo.py +++ b/sigi/apps/ocorrencias/migrations/0011_alter_categoria_tipo.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0010_alter_ocorrencia_options_ocorrencia_interno"), ] diff --git a/sigi/apps/ocorrencias/migrations/0012_alter_comentario_descricao.py b/sigi/apps/ocorrencias/migrations/0012_alter_comentario_descricao.py index 3369c45..590d5e5 100644 --- a/sigi/apps/ocorrencias/migrations/0012_alter_comentario_descricao.py +++ b/sigi/apps/ocorrencias/migrations/0012_alter_comentario_descricao.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("ocorrencias", "0011_alter_categoria_tipo"), ] @@ -13,6 +12,8 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="comentario", name="descricao", - field=models.TextField(blank=True, null=True, verbose_name="Comentário"), + field=models.TextField( + blank=True, null=True, verbose_name="Comentário" + ), ), ] diff --git a/sigi/apps/ocorrencias/models.py b/sigi/apps/ocorrencias/models.py index bb3f5f3..c586c0c 100644 --- a/sigi/apps/ocorrencias/models.py +++ b/sigi/apps/ocorrencias/models.py @@ -112,10 +112,14 @@ class Ocorrencia(models.Model): Categoria, on_delete=models.PROTECT, verbose_name=_("Categoria") ) tipo_contato = models.ForeignKey( - TipoContato, on_delete=models.PROTECT, verbose_name=_("Tipo de contato") + TipoContato, + on_delete=models.PROTECT, + verbose_name=_("Tipo de contato"), ) assunto = models.CharField(_("Assunto"), max_length=200) - status = models.IntegerField(_("Status"), choices=STATUS_CHOICES, default=1) + status = models.IntegerField( + _("Status"), choices=STATUS_CHOICES, default=1 + ) prioridade = models.IntegerField( _("Prioridade"), choices=PRIORITY_CHOICES, default=3 ) diff --git a/sigi/apps/ocorrencias/views.py b/sigi/apps/ocorrencias/views.py index 57c2060..f6fc3fa 100644 --- a/sigi/apps/ocorrencias/views.py +++ b/sigi/apps/ocorrencias/views.py @@ -148,7 +148,9 @@ class PainelOcorrenciaView(LoginRequiredMixin, UserPassesTestMixin, ListView): if filter.data.get("servidor"): servidor = Servidor.objects.get(id=filter.data.get("servidor")) subts.append( - _(f"Registradas ou comentadas por {servidor.get_apelido()}") + _( + f"Registradas ou comentadas por {servidor.get_apelido()}" + ) ) if filter.data.get("tipo_categoria"): tipo = dict(Categoria.TIPO_CHOICES)[ diff --git a/sigi/apps/parlamentares/admin.py b/sigi/apps/parlamentares/admin.py index 1c95555..b90240d 100644 --- a/sigi/apps/parlamentares/admin.py +++ b/sigi/apps/parlamentares/admin.py @@ -101,7 +101,9 @@ class SenadorImportResource(resources.ModelResource): def __init__(self): super().__init__() self.partidos = {p.sigla.upper(): p for p in Partido.objects.all()} - self.partidos.update({p.nome.upper(): p for p in Partido.objects.all()}) + self.partidos.update( + {p.nome.upper(): p for p in Partido.objects.all()} + ) self.ufs = {uf.sigla: uf for uf in UnidadeFederativa.objects.all()} def before_import_row(self, row, row_number=None, **kwargs): diff --git a/sigi/apps/parlamentares/migrations/0001_initial.py b/sigi/apps/parlamentares/migrations/0001_initial.py index 4a67142..dd1a8cf 100644 --- a/sigi/apps/parlamentares/migrations/0001_initial.py +++ b/sigi/apps/parlamentares/migrations/0001_initial.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("casas", "__first__"), ] @@ -51,7 +50,9 @@ class Migration(migrations.Migration): ( "numero_votos", models.PositiveIntegerField( - null=True, verbose_name="n\xfamero de votos", blank=True + null=True, + verbose_name="n\xfamero de votos", + blank=True, ), ), ], @@ -171,7 +172,8 @@ class Migration(migrations.Migration): ( "legislatura", models.ForeignKey( - to="parlamentares.Legislatura", on_delete=models.CASCADE + to="parlamentares.Legislatura", + on_delete=models.CASCADE, ), ), ], @@ -275,7 +277,9 @@ class Migration(migrations.Migration): ( "data_nascimento", models.DateField( - null=True, verbose_name="data de nascimento", blank=True + null=True, + verbose_name="data de nascimento", + blank=True, ), ), ( @@ -363,7 +367,8 @@ class Migration(migrations.Migration): ( "legislatura", models.ForeignKey( - to="parlamentares.Legislatura", on_delete=models.CASCADE + to="parlamentares.Legislatura", + on_delete=models.CASCADE, ), ), ( diff --git a/sigi/apps/parlamentares/migrations/0002_auto_20210406_1945.py b/sigi/apps/parlamentares/migrations/0002_auto_20210406_1945.py index e9e5f95..cce8267 100644 --- a/sigi/apps/parlamentares/migrations/0002_auto_20210406_1945.py +++ b/sigi/apps/parlamentares/migrations/0002_auto_20210406_1945.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("parlamentares", "0001_initial"), ("casas", "0014_auto_20210406_1945"), @@ -15,7 +14,9 @@ class Migration(migrations.Migration): migrations.AlterField( model_name="legislatura", name="casa_legislativa", - field=models.ForeignKey(to="casas.Orgao", on_delete=models.CASCADE), + field=models.ForeignKey( + to="casas.Orgao", on_delete=models.CASCADE + ), preserve_default=True, ), migrations.AlterField( diff --git a/sigi/apps/parlamentares/migrations/0003_auto_20210416_0841.py b/sigi/apps/parlamentares/migrations/0003_auto_20210416_0841.py index d771444..f64f53e 100644 --- a/sigi/apps/parlamentares/migrations/0003_auto_20210416_0841.py +++ b/sigi/apps/parlamentares/migrations/0003_auto_20210416_0841.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("parlamentares", "0002_auto_20210406_1945"), ] diff --git a/sigi/apps/parlamentares/migrations/0004_partido_legenda_alter_cargo_id_alter_coligacao_id_and_more.py b/sigi/apps/parlamentares/migrations/0004_partido_legenda_alter_cargo_id_alter_coligacao_id_and_more.py index ebab244..ec1317c 100644 --- a/sigi/apps/parlamentares/migrations/0004_partido_legenda_alter_cargo_id_alter_coligacao_id_and_more.py +++ b/sigi/apps/parlamentares/migrations/0004_partido_legenda_alter_cargo_id_alter_coligacao_id_and_more.py @@ -4,95 +4,159 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0003_auto_20210416_0841'), + ("parlamentares", "0003_auto_20210416_0841"), ] operations = [ migrations.AddField( - model_name='partido', - name='legenda', - field=models.PositiveIntegerField(default=0, verbose_name='nº da legenda'), - ), - migrations.AlterField( - model_name='cargo', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='coligacao', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='composicaocoligacao', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='legislatura', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='mandato', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='membromesadiretora', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='mesadiretora', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='parlamentar', - name='email', - field=models.EmailField(blank=True, max_length=254, verbose_name='e-mail'), - ), - migrations.AlterField( - model_name='parlamentar', - name='foto', - field=models.ImageField(blank=True, height_field='foto_altura', upload_to='fotos/parlamentares', width_field='foto_largura'), - ), - migrations.AlterField( - model_name='parlamentar', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='parlamentar', - name='sexo', - field=models.CharField(choices=[('M', 'Masculino'), ('F', 'Feminino')], max_length=1), - ), - migrations.AlterField( - model_name='partido', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='partido', - name='nome', - field=models.CharField(max_length=50, verbose_name='nome'), - ), - migrations.AlterField( - model_name='partido', - name='sigla', - field=models.CharField(max_length=20, verbose_name='silga'), - ), - migrations.AlterField( - model_name='sessaolegislativa', - name='id', - field=models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), - ), - migrations.AlterField( - model_name='sessaolegislativa', - name='tipo', - field=models.CharField(choices=[('O', 'Ordinária'), ('E', 'Extraordinária')], default='O', max_length=1), + model_name="partido", + name="legenda", + field=models.PositiveIntegerField( + default=0, verbose_name="nº da legenda" + ), + ), + migrations.AlterField( + model_name="cargo", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="coligacao", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="composicaocoligacao", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="legislatura", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="mandato", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="membromesadiretora", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="mesadiretora", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="parlamentar", + name="email", + field=models.EmailField( + blank=True, max_length=254, verbose_name="e-mail" + ), + ), + migrations.AlterField( + model_name="parlamentar", + name="foto", + field=models.ImageField( + blank=True, + height_field="foto_altura", + upload_to="fotos/parlamentares", + width_field="foto_largura", + ), + ), + migrations.AlterField( + model_name="parlamentar", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="parlamentar", + name="sexo", + field=models.CharField( + choices=[("M", "Masculino"), ("F", "Feminino")], max_length=1 + ), + ), + migrations.AlterField( + model_name="partido", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="partido", + name="nome", + field=models.CharField(max_length=50, verbose_name="nome"), + ), + migrations.AlterField( + model_name="partido", + name="sigla", + field=models.CharField(max_length=20, verbose_name="silga"), + ), + migrations.AlterField( + model_name="sessaolegislativa", + name="id", + field=models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + migrations.AlterField( + model_name="sessaolegislativa", + name="tipo", + field=models.CharField( + choices=[("O", "Ordinária"), ("E", "Extraordinária")], + default="O", + max_length=1, + ), ), ] diff --git a/sigi/apps/parlamentares/migrations/0005_remove_coligacao_legislatura_and_more.py b/sigi/apps/parlamentares/migrations/0005_remove_coligacao_legislatura_and_more.py index a110b6d..c0d4d5e 100644 --- a/sigi/apps/parlamentares/migrations/0005_remove_coligacao_legislatura_and_more.py +++ b/sigi/apps/parlamentares/migrations/0005_remove_coligacao_legislatura_and_more.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("casas", "0023_funcionario_cpf_funcionario_identidade"), ( @@ -70,7 +69,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name="parlamentar", name="presidente", - field=models.BooleanField(default=False, verbose_name="presidente"), + field=models.BooleanField( + default=False, verbose_name="presidente" + ), ), migrations.AddField( model_name="parlamentar", diff --git a/sigi/apps/parlamentares/migrations/0006_alter_partido_sigla.py b/sigi/apps/parlamentares/migrations/0006_alter_partido_sigla.py index 6ac1652..33d8ca9 100644 --- a/sigi/apps/parlamentares/migrations/0006_alter_partido_sigla.py +++ b/sigi/apps/parlamentares/migrations/0006_alter_partido_sigla.py @@ -4,15 +4,14 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0005_remove_coligacao_legislatura_and_more'), + ("parlamentares", "0005_remove_coligacao_legislatura_and_more"), ] operations = [ migrations.AlterField( - model_name='partido', - name='sigla', - field=models.CharField(max_length=20, verbose_name='sigla'), + model_name="partido", + name="sigla", + field=models.CharField(max_length=20, verbose_name="sigla"), ), ] diff --git a/sigi/apps/parlamentares/migrations/0007_alter_parlamentar_options.py b/sigi/apps/parlamentares/migrations/0007_alter_parlamentar_options.py index f48a030..23dcacc 100644 --- a/sigi/apps/parlamentares/migrations/0007_alter_parlamentar_options.py +++ b/sigi/apps/parlamentares/migrations/0007_alter_parlamentar_options.py @@ -4,14 +4,16 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0006_alter_partido_sigla'), + ("parlamentares", "0006_alter_partido_sigla"), ] operations = [ migrations.AlterModelOptions( - name='parlamentar', - options={'ordering': ('presidente', 'nome_completo'), 'verbose_name_plural': 'parlamentares'}, + name="parlamentar", + options={ + "ordering": ("presidente", "nome_completo"), + "verbose_name_plural": "parlamentares", + }, ), ] diff --git a/sigi/apps/parlamentares/migrations/0008_alter_parlamentar_foto.py b/sigi/apps/parlamentares/migrations/0008_alter_parlamentar_foto.py index bc47080..c0a68b5 100644 --- a/sigi/apps/parlamentares/migrations/0008_alter_parlamentar_foto.py +++ b/sigi/apps/parlamentares/migrations/0008_alter_parlamentar_foto.py @@ -4,15 +4,19 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0007_alter_parlamentar_options'), + ("parlamentares", "0007_alter_parlamentar_options"), ] operations = [ migrations.AlterField( - model_name='parlamentar', - name='foto', - field=models.ImageField(blank=True, height_field='foto_altura', upload_to='parlamentares/parlamentar/fotos', width_field='foto_largura'), + model_name="parlamentar", + name="foto", + field=models.ImageField( + blank=True, + height_field="foto_altura", + upload_to="parlamentares/parlamentar/fotos", + width_field="foto_largura", + ), ), ] diff --git a/sigi/apps/parlamentares/migrations/0009_parlamentar_ano_eleicao_parlamentar_flag_importa_and_more.py b/sigi/apps/parlamentares/migrations/0009_parlamentar_ano_eleicao_parlamentar_flag_importa_and_more.py index 3bb53fe..8ae7861 100644 --- a/sigi/apps/parlamentares/migrations/0009_parlamentar_ano_eleicao_parlamentar_flag_importa_and_more.py +++ b/sigi/apps/parlamentares/migrations/0009_parlamentar_ano_eleicao_parlamentar_flag_importa_and_more.py @@ -4,35 +4,59 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0008_alter_parlamentar_foto'), + ("parlamentares", "0008_alter_parlamentar_foto"), ] operations = [ migrations.AddField( - model_name='parlamentar', - name='ano_eleicao', - field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Ano de eleição'), + model_name="parlamentar", + name="ano_eleicao", + field=models.PositiveIntegerField( + blank=True, null=True, verbose_name="Ano de eleição" + ), ), migrations.AddField( - model_name='parlamentar', - name='flag_importa', - field=models.CharField(blank=True, default='', editable=False, max_length=1), + model_name="parlamentar", + name="flag_importa", + field=models.CharField( + blank=True, default="", editable=False, max_length=1 + ), ), migrations.AddField( - model_name='parlamentar', - name='sequencial_tse', - field=models.CharField(blank=True, default='', editable=False, max_length=20, verbose_name='Sequencial TSE'), + model_name="parlamentar", + name="sequencial_tse", + field=models.CharField( + blank=True, + default="", + editable=False, + max_length=20, + verbose_name="Sequencial TSE", + ), ), migrations.AddField( - model_name='parlamentar', - name='status_mandato', - field=models.CharField(choices=[('E', 'Em exercício'), ('S', 'Suplente'), ('I', 'Inativo')], default='E', max_length=1, verbose_name='status do mandato'), + model_name="parlamentar", + name="status_mandato", + field=models.CharField( + choices=[ + ("E", "Em exercício"), + ("S", "Suplente"), + ("I", "Inativo"), + ], + default="E", + max_length=1, + verbose_name="status do mandato", + ), ), migrations.AlterField( - model_name='parlamentar', - name='foto', - field=models.ImageField(blank=True, height_field='foto_altura', max_length=200, upload_to='parlamentares/parlamentar/fotos', width_field='foto_largura'), + model_name="parlamentar", + name="foto", + field=models.ImageField( + blank=True, + height_field="foto_altura", + max_length=200, + upload_to="parlamentares/parlamentar/fotos", + width_field="foto_largura", + ), ), ] diff --git a/sigi/apps/parlamentares/migrations/0010_alter_parlamentar_options.py b/sigi/apps/parlamentares/migrations/0010_alter_parlamentar_options.py index 5c20750..1fcf25f 100644 --- a/sigi/apps/parlamentares/migrations/0010_alter_parlamentar_options.py +++ b/sigi/apps/parlamentares/migrations/0010_alter_parlamentar_options.py @@ -4,14 +4,19 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0009_parlamentar_ano_eleicao_parlamentar_flag_importa_and_more'), + ( + "parlamentares", + "0009_parlamentar_ano_eleicao_parlamentar_flag_importa_and_more", + ), ] operations = [ migrations.AlterModelOptions( - name='parlamentar', - options={'ordering': ('status_mandato', 'presidente', 'nome_completo'), 'verbose_name_plural': 'parlamentares'}, + name="parlamentar", + options={ + "ordering": ("status_mandato", "presidente", "nome_completo"), + "verbose_name_plural": "parlamentares", + }, ), ] diff --git a/sigi/apps/parlamentares/migrations/0011_alter_parlamentar_options.py b/sigi/apps/parlamentares/migrations/0011_alter_parlamentar_options.py index 5cb9b9b..6eb9fd8 100644 --- a/sigi/apps/parlamentares/migrations/0011_alter_parlamentar_options.py +++ b/sigi/apps/parlamentares/migrations/0011_alter_parlamentar_options.py @@ -4,14 +4,16 @@ from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('parlamentares', '0010_alter_parlamentar_options'), + ("parlamentares", "0010_alter_parlamentar_options"), ] operations = [ migrations.AlterModelOptions( - name='parlamentar', - options={'ordering': ('status_mandato', '-presidente', 'nome_completo'), 'verbose_name_plural': 'parlamentares'}, + name="parlamentar", + options={ + "ordering": ("status_mandato", "-presidente", "nome_completo"), + "verbose_name_plural": "parlamentares", + }, ), ] diff --git a/sigi/apps/parlamentares/migrations/0012_senador.py b/sigi/apps/parlamentares/migrations/0012_senador.py index c2490ae..87fa40e 100644 --- a/sigi/apps/parlamentares/migrations/0012_senador.py +++ b/sigi/apps/parlamentares/migrations/0012_senador.py @@ -5,7 +5,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ( "contatos", @@ -27,14 +26,21 @@ class Migration(migrations.Migration): verbose_name="ID", ), ), - ("codigo", models.IntegerField(unique=True, verbose_name="código")), + ( + "codigo", + models.IntegerField(unique=True, verbose_name="código"), + ), ( "nome_parlamentar", - models.CharField(max_length=100, verbose_name="nome parlamentar"), + models.CharField( + max_length=100, verbose_name="nome parlamentar" + ), ), ( "nome_completo", - models.CharField(max_length=100, verbose_name="nome completo"), + models.CharField( + max_length=100, verbose_name="nome completo" + ), ), ( "sexo", @@ -46,9 +52,14 @@ class Migration(migrations.Migration): ), ( "forma_tratamento", - models.CharField(max_length=50, verbose_name="forma de tratamento"), + models.CharField( + max_length=50, verbose_name="forma de tratamento" + ), + ), + ( + "email", + models.EmailField(max_length=254, verbose_name="e-mail"), ), - ("email", models.EmailField(max_length=254, verbose_name="e-mail")), ( "partido", models.ForeignKey( diff --git a/sigi/apps/parlamentares/models.py b/sigi/apps/parlamentares/models.py index 927506e..dbfd445 100644 --- a/sigi/apps/parlamentares/models.py +++ b/sigi/apps/parlamentares/models.py @@ -32,7 +32,10 @@ class Parlamentar(models.Model): _("Ano de eleição"), blank=True, null=True ) status_mandato = models.CharField( - _("status do mandato"), max_length=1, choices=STATUS_CHOICE, default="E" + _("status do mandato"), + max_length=1, + choices=STATUS_CHOICE, + default="E", ) presidente = models.BooleanField(_("presidente"), default=False) nome_completo = models.CharField(max_length=128) @@ -124,7 +127,9 @@ class Senador(models.Model): nome_parlamentar = models.CharField(_("nome parlamentar"), max_length=100) nome_completo = models.CharField(_("nome completo"), max_length=100) sexo = models.CharField(_("sexo"), max_length=1, choices=SEXO_CHOICES) - forma_tratamento = models.CharField(_("forma de tratamento"), max_length=50) + forma_tratamento = models.CharField( + _("forma de tratamento"), max_length=50 + ) email = models.EmailField(_("e-mail")) class Meta: diff --git a/sigi/apps/parlamentares/reports.py b/sigi/apps/parlamentares/reports.py index 9383e6e..3c1454f 100644 --- a/sigi/apps/parlamentares/reports.py +++ b/sigi/apps/parlamentares/reports.py @@ -198,7 +198,6 @@ class CasasLegislativasReport(ReportDefault): page_size = landscape(A4) class band_page_header(ReportDefault.band_page_header): - label_top = ReportDefault.band_page_header.label_top label_left = [0.3, 1, 5.5, 11, 17, 22] elements = list(ReportDefault.band_page_header.elements) @@ -293,7 +292,6 @@ class CasasLegislativasReport(ReportDefault): pass class band_detail(ReportDefault.band_detail): - label_left = [0.3, 1, 5.5, 11, 17, 22] elements = [ @@ -359,7 +357,6 @@ class InfoOrgao(ReportDefault): ] class band_detail(ReportDefault.band_detail): - posicao_left = [ 0, 1.3, # Tipo @@ -538,7 +535,9 @@ class InfoOrgao(ReportDefault): width=BAND_WIDTH, top=1 * cm, ), - Label(text=_("Número"), left=tel_left[0] * cm, top=tel_top), + Label( + text=_("Número"), left=tel_left[0] * cm, top=tel_top + ), Label(text=_("Tipo"), left=tel_left[1] * cm, top=tel_top), Label(text=_("Nota"), left=tel_left[2] * cm, top=tel_top), ], @@ -579,8 +578,12 @@ class InfoOrgao(ReportDefault): width=BAND_WIDTH, top=1 * cm, ), - Label(text=_("Nome"), left=cont_left[0] * cm, top=cont_top), - Label(text=_("Nota"), left=cont_left[1] * cm, top=cont_top), + Label( + text=_("Nome"), left=cont_left[0] * cm, top=cont_top + ), + Label( + text=_("Nota"), left=cont_left[1] * cm, top=cont_top + ), Label( text=_("E-mail"), left=cont_left[2] * cm, top=cont_top ), @@ -593,7 +596,9 @@ class InfoOrgao(ReportDefault): elements=[ ObjectValue(attribute_name="nome", left=cont_left[0] * cm), ObjectValue(attribute_name="nota", left=cont_left[1] * cm), - ObjectValue(attribute_name="email", left=cont_left[2] * cm), + ObjectValue( + attribute_name="email", left=cont_left[2] * cm + ), ], # borders = {'all':True}, ), diff --git a/sigi/apps/servicos/filters.py b/sigi/apps/servicos/filters.py index af22ac1..b466902 100644 --- a/sigi/apps/servicos/filters.py +++ b/sigi/apps/servicos/filters.py @@ -11,7 +11,9 @@ class ServicoAtivoFilter(admin.FieldListFilter): self.model_admin = model_admin self.parameter_name = f"{field_path}__isnull" - super().__init__(field, request, params, model, model_admin, field_path) + super().__init__( + field, request, params, model, model_admin, field_path + ) self.title = _("Serviço ativo") diff --git a/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py b/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py index 2e8e098..b4c891c 100644 --- a/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py +++ b/sigi/apps/servicos/jobs/daily/sincroniza_rancher.py @@ -187,7 +187,9 @@ class Job(JobReportMixin, DailyJob): # Desativa portais registrados no SIGI que não estão no Rancher # nomes_instancias = [p["metadata"]["name"] for p in portais] for portal in Servico.objects.filter( - tipo_servico=tipo, data_desativacao=None, hospedagem_interlegis=True + tipo_servico=tipo, + data_desativacao=None, + hospedagem_interlegis=True, ): if ( portal.instancia == "" @@ -207,7 +209,9 @@ class Job(JobReportMixin, DailyJob): self.infos[tipo].append( _(f"{encontrados} {tipo.nome} do Rancher encontrados no SIGI") ) - self.infos[tipo].append(_(f"{novos} novos {tipo.nome} criados no SIGI")) + self.infos[tipo].append( + _(f"{novos} novos {tipo.nome} criados no SIGI") + ) self.infos[tipo].append( _(f"{desativados} {tipo.nome} desativados no SIGI") ) diff --git a/sigi/apps/servicos/migrations/0001_initial.py b/sigi/apps/servicos/migrations/0001_initial.py index 46c0d86..30a87b0 100644 --- a/sigi/apps/servicos/migrations/0001_initial.py +++ b/sigi/apps/servicos/migrations/0001_initial.py @@ -6,7 +6,6 @@ import datetime class Migration(migrations.Migration): - dependencies = [ ("casas", "0001_initial"), ] diff --git a/sigi/apps/servicos/migrations/0002_tiposervico_modo.py b/sigi/apps/servicos/migrations/0002_tiposervico_modo.py index 3fda59b..44fbbfe 100644 --- a/sigi/apps/servicos/migrations/0002_tiposervico_modo.py +++ b/sigi/apps/servicos/migrations/0002_tiposervico_modo.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("servicos", "0001_initial"), ] diff --git a/sigi/apps/servicos/migrations/0003_auto_20170407_1003.py b/sigi/apps/servicos/migrations/0003_auto_20170407_1003.py index ad777be..a1dcc14 100644 --- a/sigi/apps/servicos/migrations/0003_auto_20170407_1003.py +++ b/sigi/apps/servicos/migrations/0003_auto_20170407_1003.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servicos", "0002_tiposervico_modo"), ] diff --git a/sigi/apps/servicos/migrations/0004_delete_casaatendida.py b/sigi/apps/servicos/migrations/0004_delete_casaatendida.py index 00faaa7..5ac4784 100644 --- a/sigi/apps/servicos/migrations/0004_delete_casaatendida.py +++ b/sigi/apps/servicos/migrations/0004_delete_casaatendida.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("servicos", "0003_auto_20170407_1003"), ] diff --git a/sigi/apps/servicos/migrations/0005_auto_20210406_1945.py b/sigi/apps/servicos/migrations/0005_auto_20210406_1945.py index 20227e3..0371a1a 100644 --- a/sigi/apps/servicos/migrations/0005_auto_20210406_1945.py +++ b/sigi/apps/servicos/migrations/0005_auto_20210406_1945.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("servicos", "0004_delete_casaatendida"), ("casas", "0014_auto_20210406_1945"), diff --git a/sigi/apps/servicos/migrations/0006_casaatendida.py b/sigi/apps/servicos/migrations/0006_casaatendida.py index ae1d9fb..4d7b2ae 100644 --- a/sigi/apps/servicos/migrations/0006_casaatendida.py +++ b/sigi/apps/servicos/migrations/0006_casaatendida.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("casas", "0014_auto_20210406_1945"), ("servicos", "0005_auto_20210406_1945"), diff --git a/sigi/apps/servicos/migrations/0007_auto_20210416_0841.py b/sigi/apps/servicos/migrations/0007_auto_20210416_0841.py index 694742a..67b45f2 100644 --- a/sigi/apps/servicos/migrations/0007_auto_20210416_0841.py +++ b/sigi/apps/servicos/migrations/0007_auto_20210416_0841.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servicos", "0006_casaatendida"), ] diff --git a/sigi/apps/servicos/migrations/0008_auto_20210519_1117.py b/sigi/apps/servicos/migrations/0008_auto_20210519_1117.py index cc29e9b..1fb9462 100644 --- a/sigi/apps/servicos/migrations/0008_auto_20210519_1117.py +++ b/sigi/apps/servicos/migrations/0008_auto_20210519_1117.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("servicos", "0007_auto_20210416_0841"), ] diff --git a/sigi/apps/servicos/migrations/0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more.py b/sigi/apps/servicos/migrations/0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more.py index 2b133d4..96cfc3a 100644 --- a/sigi/apps/servicos/migrations/0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more.py +++ b/sigi/apps/servicos/migrations/0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("servicos", "0008_auto_20210519_1117"), ] diff --git a/sigi/apps/servicos/migrations/0010_delete_casaatendida_alter_tiposervico_options_and_more.py b/sigi/apps/servicos/migrations/0010_delete_casaatendida_alter_tiposervico_options_and_more.py index 69b5bdb..b99e82a 100644 --- a/sigi/apps/servicos/migrations/0010_delete_casaatendida_alter_tiposervico_options_and_more.py +++ b/sigi/apps/servicos/migrations/0010_delete_casaatendida_alter_tiposervico_options_and_more.py @@ -5,37 +5,58 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ - ('servicos', '0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more'), + ( + "servicos", + "0009_alter_casamanifesta_email_alter_casamanifesta_id_and_more", + ), ] operations = [ migrations.DeleteModel( - name='CasaAtendida', + name="CasaAtendida", ), migrations.AlterModelOptions( - name='tiposervico', - options={'verbose_name': 'tipo de serviço', 'verbose_name_plural': 'tipos de serviço'}, + name="tiposervico", + options={ + "verbose_name": "tipo de serviço", + "verbose_name_plural": "tipos de serviço", + }, ), migrations.AlterField( - model_name='servico', - name='tipo_servico', - field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='servicos.tiposervico', verbose_name='tipo de serviço'), + model_name="servico", + name="tipo_servico", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="servicos.tiposervico", + verbose_name="tipo de serviço", + ), ), migrations.AlterField( - model_name='tiposervico', - name='template_email_altera', - field=models.TextField(blank=True, help_text='Use:
\n {url} para incluir a URL do serviço,
\n {senha} para incluir a senha inicial do serviço', verbose_name='template de email de alteração'), + model_name="tiposervico", + name="template_email_altera", + field=models.TextField( + blank=True, + help_text="Use:
\n {url} para incluir a URL do serviço,
\n {senha} para incluir a senha inicial do serviço", + verbose_name="template de email de alteração", + ), ), migrations.AlterField( - model_name='tiposervico', - name='template_email_ativa', - field=models.TextField(blank=True, help_text='Use:
\n {url} para incluir a URL do serviço,
\n {senha} para incluir a senha inicial do serviço', verbose_name='template de email de ativação'), + model_name="tiposervico", + name="template_email_ativa", + field=models.TextField( + blank=True, + help_text="Use:
\n {url} para incluir a URL do serviço,
\n {senha} para incluir a senha inicial do serviço", + verbose_name="template de email de ativação", + ), ), migrations.AlterField( - model_name='tiposervico', - name='template_email_desativa', - field=models.TextField(blank=True, help_text='Use:
\n {url} para incluir a URL do serviço,
\n {senha} para incluir a senha inicial do serviço
{motivo} para incluir o motivo da desativação do serviço', verbose_name='template de email de desativação'), + model_name="tiposervico", + name="template_email_desativa", + field=models.TextField( + blank=True, + help_text="Use:
\n {url} para incluir a URL do serviço,
\n {senha} para incluir a senha inicial do serviço
{motivo} para incluir o motivo da desativação do serviço", + verbose_name="template de email de desativação", + ), ), ] diff --git a/sigi/apps/servicos/migrations/0011_remove_servico_contato_administrativo_and_more.py b/sigi/apps/servicos/migrations/0011_remove_servico_contato_administrativo_and_more.py index 88b9c3f..a3a8846 100644 --- a/sigi/apps/servicos/migrations/0011_remove_servico_contato_administrativo_and_more.py +++ b/sigi/apps/servicos/migrations/0011_remove_servico_contato_administrativo_and_more.py @@ -4,45 +4,59 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('servicos', '0010_delete_casaatendida_alter_tiposervico_options_and_more'), + ( + "servicos", + "0010_delete_casaatendida_alter_tiposervico_options_and_more", + ), ] operations = [ migrations.RemoveField( - model_name='servico', - name='contato_administrativo', + model_name="servico", + name="contato_administrativo", ), migrations.RemoveField( - model_name='servico', - name='contato_tecnico', + model_name="servico", + name="contato_tecnico", ), migrations.RemoveField( - model_name='servico', - name='nome_servidor', + model_name="servico", + name="nome_servidor", ), migrations.RemoveField( - model_name='servico', - name='porta_servico', + model_name="servico", + name="porta_servico", ), migrations.RemoveField( - model_name='servico', - name='senha_inicial', + model_name="servico", + name="senha_inicial", ), migrations.AlterField( - model_name='tiposervico', - name='template_email_altera', - field=models.TextField(blank=True, help_text='Use a marcação {url} para incluir a URL do serviço,
', verbose_name='template de email de alteração'), + model_name="tiposervico", + name="template_email_altera", + field=models.TextField( + blank=True, + help_text="Use a marcação {url} para incluir a URL do serviço,
", + verbose_name="template de email de alteração", + ), ), migrations.AlterField( - model_name='tiposervico', - name='template_email_ativa', - field=models.TextField(blank=True, help_text='Use a marcação {url} para incluir a URL do serviço,
', verbose_name='template de email de ativação'), + model_name="tiposervico", + name="template_email_ativa", + field=models.TextField( + blank=True, + help_text="Use a marcação {url} para incluir a URL do serviço,
", + verbose_name="template de email de ativação", + ), ), migrations.AlterField( - model_name='tiposervico', - name='template_email_desativa', - field=models.TextField(blank=True, help_text='Use a marcação {url} para incluir a URL do serviço,

{motivo} para incluir o motivo da desativação do serviço', verbose_name='template de email de desativação'), + model_name="tiposervico", + name="template_email_desativa", + field=models.TextField( + blank=True, + help_text="Use a marcação {url} para incluir a URL do serviço,

{motivo} para incluir o motivo da desativação do serviço", + verbose_name="template de email de desativação", + ), ), ] diff --git a/sigi/apps/servicos/migrations/0012_servico_data_verificacao_and_more.py b/sigi/apps/servicos/migrations/0012_servico_data_verificacao_and_more.py index fca4216..38d2fe7 100644 --- a/sigi/apps/servicos/migrations/0012_servico_data_verificacao_and_more.py +++ b/sigi/apps/servicos/migrations/0012_servico_data_verificacao_and_more.py @@ -4,20 +4,35 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('servicos', '0011_remove_servico_contato_administrativo_and_more'), + ("servicos", "0011_remove_servico_contato_administrativo_and_more"), ] operations = [ migrations.AddField( - model_name='servico', - name='data_verificacao', - field=models.DateTimeField(blank=True, null=True, verbose_name='data da última verificação'), + model_name="servico", + name="data_verificacao", + field=models.DateTimeField( + blank=True, + null=True, + verbose_name="data da última verificação", + ), ), migrations.AddField( - model_name='servico', - name='resultado_verificacao', - field=models.CharField(choices=[('N', 'Não verificado'), ('F', 'Funcionando'), ('U', 'Nunca foi usado'), ('D', 'Acesso negado'), ('O', 'Fora do ar'), ('I', 'Dados imcompatíveis - não é serviço Interlegis')], default='N', max_length=1, verbose_name='resultado da verificação'), + model_name="servico", + name="resultado_verificacao", + field=models.CharField( + choices=[ + ("N", "Não verificado"), + ("F", "Funcionando"), + ("U", "Nunca foi usado"), + ("D", "Acesso negado"), + ("O", "Fora do ar"), + ("I", "Dados imcompatíveis - não é serviço Interlegis"), + ], + default="N", + max_length=1, + verbose_name="resultado da verificação", + ), ), ] diff --git a/sigi/apps/servicos/migrations/0013_alter_logservico_data_alter_servico_data_ativacao.py b/sigi/apps/servicos/migrations/0013_alter_logservico_data_alter_servico_data_ativacao.py index a86314a..0439b5f 100644 --- a/sigi/apps/servicos/migrations/0013_alter_logservico_data_alter_servico_data_ativacao.py +++ b/sigi/apps/servicos/migrations/0013_alter_logservico_data_alter_servico_data_ativacao.py @@ -5,20 +5,25 @@ import django.utils.timezone class Migration(migrations.Migration): - dependencies = [ - ('servicos', '0012_servico_data_verificacao_and_more'), + ("servicos", "0012_servico_data_verificacao_and_more"), ] operations = [ migrations.AlterField( - model_name='logservico', - name='data', - field=models.DateField(default=django.utils.timezone.localdate, verbose_name='Data da ação'), + model_name="logservico", + name="data", + field=models.DateField( + default=django.utils.timezone.localdate, + verbose_name="Data da ação", + ), ), migrations.AlterField( - model_name='servico', - name='data_ativacao', - field=models.DateField(default=django.utils.timezone.localdate, verbose_name='Data de ativação'), + model_name="servico", + name="data_ativacao", + field=models.DateField( + default=django.utils.timezone.localdate, + verbose_name="Data de ativação", + ), ), ] diff --git a/sigi/apps/servicos/migrations/0014_servico_instancia_servico_versao_and_more.py b/sigi/apps/servicos/migrations/0014_servico_instancia_servico_versao_and_more.py index aa3a9f5..7662276 100644 --- a/sigi/apps/servicos/migrations/0014_servico_instancia_servico_versao_and_more.py +++ b/sigi/apps/servicos/migrations/0014_servico_instancia_servico_versao_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("servicos", "0013_alter_logservico_data_alter_servico_data_ativacao"), ] @@ -20,7 +19,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name="servico", name="versao", - field=models.CharField(blank=True, max_length=20, verbose_name="versão"), + field=models.CharField( + blank=True, max_length=20, verbose_name="versão" + ), ), migrations.AddField( model_name="tiposervico", @@ -40,14 +41,18 @@ class Migration(migrations.Migration): model_name="tiposervico", name="spec_rancher", field=models.CharField( - blank=True, max_length=100, verbose_name="spec do serviço no Rancher" + blank=True, + max_length=100, + verbose_name="spec do serviço no Rancher", ), ), migrations.AddField( model_name="tiposervico", name="tipo_rancher", field=models.CharField( - blank=True, max_length=100, verbose_name="tipo de objeto no Rancher" + blank=True, + max_length=100, + verbose_name="tipo de objeto no Rancher", ), ), ] diff --git a/sigi/apps/servicos/migrations/0015_nomeia_instancias.py b/sigi/apps/servicos/migrations/0015_nomeia_instancias.py index 7aac613..32b60fb 100644 --- a/sigi/apps/servicos/migrations/0015_nomeia_instancias.py +++ b/sigi/apps/servicos/migrations/0015_nomeia_instancias.py @@ -17,7 +17,6 @@ def instance_names_rw(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("servicos", "0014_servico_instancia_servico_versao_and_more"), ] diff --git a/sigi/apps/servicos/migrations/0016_prepare_unique_tipo_servico_instancia_data_desativacao.py b/sigi/apps/servicos/migrations/0016_prepare_unique_tipo_servico_instancia_data_desativacao.py index 559ac50..e1b078c 100644 --- a/sigi/apps/servicos/migrations/0016_prepare_unique_tipo_servico_instancia_data_desativacao.py +++ b/sigi/apps/servicos/migrations/0016_prepare_unique_tipo_servico_instancia_data_desativacao.py @@ -17,13 +17,12 @@ def instance_names_fw(apps, schema_editor): def instance_names_rw(apps, schema_editor): Servico = apps.get_model("servicos", "Servico") - Servico.objects.filter(instancia__startswith="instancia-desativada").update( - instancia="" - ) + Servico.objects.filter( + instancia__startswith="instancia-desativada" + ).update(instancia="") class Migration(migrations.Migration): - dependencies = [ ("servicos", "0015_nomeia_instancias"), ] diff --git a/sigi/apps/servicos/migrations/0017_alter_servico_options_servico_unique_instance.py b/sigi/apps/servicos/migrations/0017_alter_servico_options_servico_unique_instance.py index 31d211e..20f7e39 100644 --- a/sigi/apps/servicos/migrations/0017_alter_servico_options_servico_unique_instance.py +++ b/sigi/apps/servicos/migrations/0017_alter_servico_options_servico_unique_instance.py @@ -4,9 +4,11 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ("servicos", "0016_prepare_unique_tipo_servico_instancia_data_desativacao"), + ( + "servicos", + "0016_prepare_unique_tipo_servico_instancia_data_desativacao", + ), ] operations = [ diff --git a/sigi/apps/servicos/migrations/0018_servico_flag_confirmado.py b/sigi/apps/servicos/migrations/0018_servico_flag_confirmado.py index d177fe1..15f3723 100644 --- a/sigi/apps/servicos/migrations/0018_servico_flag_confirmado.py +++ b/sigi/apps/servicos/migrations/0018_servico_flag_confirmado.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("servicos", "0017_alter_servico_options_servico_unique_instance"), ] @@ -14,7 +13,8 @@ class Migration(migrations.Migration): model_name="servico", name="flag_confirmado", field=models.BooleanField( - default=False, verbose_name="indica se o registro foi confirmado" + default=False, + verbose_name="indica se o registro foi confirmado", ), ), ] diff --git a/sigi/apps/servicos/migrations/0019_ajusta_dominios.py b/sigi/apps/servicos/migrations/0019_ajusta_dominios.py index dd466a1..c8c62b6 100644 --- a/sigi/apps/servicos/migrations/0019_ajusta_dominios.py +++ b/sigi/apps/servicos/migrations/0019_ajusta_dominios.py @@ -38,7 +38,6 @@ def dominios_rw(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("servicos", "0018_servico_flag_confirmado"), ] diff --git a/sigi/apps/servicos/migrations/0020_servico_apps.py b/sigi/apps/servicos/migrations/0020_servico_apps.py index 6aa2133..8a61db6 100644 --- a/sigi/apps/servicos/migrations/0020_servico_apps.py +++ b/sigi/apps/servicos/migrations/0020_servico_apps.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("servicos", "0019_ajusta_dominios"), ] @@ -13,6 +12,8 @@ class Migration(migrations.Migration): migrations.AddField( model_name="servico", name="apps", - field=models.TextField(blank=True, verbose_name="apps instaladas no DNS"), + field=models.TextField( + blank=True, verbose_name="apps instaladas no DNS" + ), ), ] diff --git a/sigi/apps/servicos/migrations/0021_remove_servico_unique_instance_and_more.py b/sigi/apps/servicos/migrations/0021_remove_servico_unique_instance_and_more.py index 677501c..057fa20 100644 --- a/sigi/apps/servicos/migrations/0021_remove_servico_unique_instance_and_more.py +++ b/sigi/apps/servicos/migrations/0021_remove_servico_unique_instance_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("servicos", "0020_servico_apps"), ] diff --git a/sigi/apps/servicos/migrations/0022_atualiza_mail_leg.py b/sigi/apps/servicos/migrations/0022_atualiza_mail_leg.py index 2d87153..0a3d452 100644 --- a/sigi/apps/servicos/migrations/0022_atualiza_mail_leg.py +++ b/sigi/apps/servicos/migrations/0022_atualiza_mail_leg.py @@ -24,7 +24,6 @@ def mailleg_rw(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("servicos", "0021_remove_servico_unique_instance_and_more"), ] diff --git a/sigi/apps/servicos/models.py b/sigi/apps/servicos/models.py index 6dc6bab..04f56be 100644 --- a/sigi/apps/servicos/models.py +++ b/sigi/apps/servicos/models.py @@ -71,7 +71,9 @@ class Servico(models.Model): Orgao, on_delete=models.PROTECT, verbose_name=_("Casa Legislativa") ) tipo_servico = models.ForeignKey( - TipoServico, on_delete=models.PROTECT, verbose_name=_("tipo de serviço") + TipoServico, + on_delete=models.PROTECT, + verbose_name=_("tipo de serviço"), ) url = models.URLField(_("URL do serviço"), blank=True) versao = models.CharField(_("versão"), max_length=20, blank=True) diff --git a/sigi/apps/servidores/management/commands/migra.py b/sigi/apps/servidores/management/commands/migra.py index 369f908..38ee517 100644 --- a/sigi/apps/servidores/management/commands/migra.py +++ b/sigi/apps/servidores/management/commands/migra.py @@ -42,7 +42,7 @@ class Command(BaseCommand): # cria um dict com a primeira e a linha atual pessoa = zip(fields, row) p = {} - for (name, value) in pessoa: + for name, value in pessoa: p[name] = value.strip() user = None diff --git a/sigi/apps/servidores/management/commands/sync_ldap.py b/sigi/apps/servidores/management/commands/sync_ldap.py index 5d7dfc8..7cb4ec1 100644 --- a/sigi/apps/servidores/management/commands/sync_ldap.py +++ b/sigi/apps/servidores/management/commands/sync_ldap.py @@ -144,7 +144,9 @@ class Command(BaseCommand): username = get_ldap_property(ldap_user, "sAMAccountName") if username: email = get_ldap_property(ldap_user, "userPrincipalName", "") - first_name = get_ldap_property(ldap_user, "givenName", username) + first_name = get_ldap_property( + ldap_user, "givenName", username + ) last_name = get_ldap_property(ldap_user, "sn", "")[:30] try: user = User.objects.get(username=username) diff --git a/sigi/apps/servidores/management/commands/test_sync_ldap.py b/sigi/apps/servidores/management/commands/test_sync_ldap.py index 73596f0..089ee69 100644 --- a/sigi/apps/servidores/management/commands/test_sync_ldap.py +++ b/sigi/apps/servidores/management/commands/test_sync_ldap.py @@ -259,7 +259,6 @@ Users are synchronized. ], ) def test_sync_users(before, ldap_users, after, messages, capsys): - # setup for user_setup in before: if type(user_setup) == tuple: diff --git a/sigi/apps/servidores/migrations/0001_initial.py b/sigi/apps/servidores/migrations/0001_initial.py index 2b68bbc..021b74c 100644 --- a/sigi/apps/servidores/migrations/0001_initial.py +++ b/sigi/apps/servidores/migrations/0001_initial.py @@ -6,7 +6,6 @@ from django.conf import settings class Migration(migrations.Migration): - dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] @@ -223,7 +222,9 @@ class Migration(migrations.Migration): ( "data_nascimento", models.DateField( - null=True, verbose_name="data de nascimento", blank=True + null=True, + verbose_name="data de nascimento", + blank=True, ), ), ( @@ -278,7 +279,10 @@ class Migration(migrations.Migration): ( "cpf", models.CharField( - max_length=11, null=True, verbose_name="CPF", blank=True + max_length=11, + null=True, + verbose_name="CPF", + blank=True, ), ), ( diff --git a/sigi/apps/servidores/migrations/0002_auto_20210416_0841.py b/sigi/apps/servidores/migrations/0002_auto_20210416_0841.py index 4453596..7ee7020 100644 --- a/sigi/apps/servidores/migrations/0002_auto_20210416_0841.py +++ b/sigi/apps/servidores/migrations/0002_auto_20210416_0841.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servidores", "0001_initial"), ] diff --git a/sigi/apps/servidores/migrations/0003_auto_20210422_1729.py b/sigi/apps/servidores/migrations/0003_auto_20210422_1729.py index 5845e98..1d37ea1 100644 --- a/sigi/apps/servidores/migrations/0003_auto_20210422_1729.py +++ b/sigi/apps/servidores/migrations/0003_auto_20210422_1729.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servidores", "0002_auto_20210416_0841"), ] diff --git a/sigi/apps/servidores/migrations/0004_auto_20210422_1907.py b/sigi/apps/servidores/migrations/0004_auto_20210422_1907.py index 4760914..34ebf43 100644 --- a/sigi/apps/servidores/migrations/0004_auto_20210422_1907.py +++ b/sigi/apps/servidores/migrations/0004_auto_20210422_1907.py @@ -6,7 +6,6 @@ import django.db.models.deletion class Migration(migrations.Migration): - dependencies = [ ("servidores", "0003_auto_20210422_1729"), ] diff --git a/sigi/apps/servidores/migrations/0005_auto_20210423_0904.py b/sigi/apps/servidores/migrations/0005_auto_20210423_0904.py index f3e8f5c..5040f80 100644 --- a/sigi/apps/servidores/migrations/0005_auto_20210423_0904.py +++ b/sigi/apps/servidores/migrations/0005_auto_20210423_0904.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("servidores", "0004_auto_20210422_1907"), ] diff --git a/sigi/apps/servidores/migrations/0006_auto_20210429_0822.py b/sigi/apps/servidores/migrations/0006_auto_20210429_0822.py index 90f23ae..ea9442e 100644 --- a/sigi/apps/servidores/migrations/0006_auto_20210429_0822.py +++ b/sigi/apps/servidores/migrations/0006_auto_20210429_0822.py @@ -6,7 +6,6 @@ from django.conf import settings class Migration(migrations.Migration): - dependencies = [ ("servidores", "0005_auto_20210423_0904"), ] diff --git a/sigi/apps/servidores/migrations/0007_auto_20210430_0735.py b/sigi/apps/servidores/migrations/0007_auto_20210430_0735.py index 162ab9f..03c5be2 100644 --- a/sigi/apps/servidores/migrations/0007_auto_20210430_0735.py +++ b/sigi/apps/servidores/migrations/0007_auto_20210430_0735.py @@ -5,7 +5,6 @@ from django.db import models, migrations class Migration(migrations.Migration): - dependencies = [ ("servidores", "0006_auto_20210429_0822"), ] diff --git a/sigi/apps/servidores/migrations/0008_alter_servico_id_alter_servidor_foto_and_more.py b/sigi/apps/servidores/migrations/0008_alter_servico_id_alter_servidor_foto_and_more.py index a9e1087..8bd36cc 100644 --- a/sigi/apps/servidores/migrations/0008_alter_servico_id_alter_servidor_foto_and_more.py +++ b/sigi/apps/servidores/migrations/0008_alter_servico_id_alter_servidor_foto_and_more.py @@ -4,7 +4,6 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ("servidores", "0007_auto_20210430_0735"), ] diff --git a/sigi/apps/servidores/migrations/0009_servidor_cargo.py b/sigi/apps/servidores/migrations/0009_servidor_cargo.py index b200aed..2a14dfd 100644 --- a/sigi/apps/servidores/migrations/0009_servidor_cargo.py +++ b/sigi/apps/servidores/migrations/0009_servidor_cargo.py @@ -4,15 +4,14 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('servidores', '0008_alter_servico_id_alter_servidor_foto_and_more'), + ("servidores", "0008_alter_servico_id_alter_servidor_foto_and_more"), ] operations = [ migrations.AddField( - model_name='servidor', - name='cargo', + model_name="servidor", + name="cargo", field=models.CharField(blank=True, max_length=100), ), ] diff --git a/sigi/apps/servidores/migrations/0010_servidor_sigi.py b/sigi/apps/servidores/migrations/0010_servidor_sigi.py index 5327a91..503a330 100644 --- a/sigi/apps/servidores/migrations/0010_servidor_sigi.py +++ b/sigi/apps/servidores/migrations/0010_servidor_sigi.py @@ -4,15 +4,16 @@ from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ - ('servidores', '0009_servidor_cargo'), + ("servidores", "0009_servidor_cargo"), ] operations = [ migrations.AddField( - model_name='servidor', - name='sigi', - field=models.BooleanField(default=False, editable=False, verbose_name='Servidor SIGI'), + model_name="servidor", + name="sigi", + field=models.BooleanField( + default=False, editable=False, verbose_name="Servidor SIGI" + ), ), ] diff --git a/sigi/apps/servidores/migrations/0011_add_servidor_sigi.py b/sigi/apps/servidores/migrations/0011_add_servidor_sigi.py index 4fdbd54..a7852fe 100644 --- a/sigi/apps/servidores/migrations/0011_add_servidor_sigi.py +++ b/sigi/apps/servidores/migrations/0011_add_servidor_sigi.py @@ -26,7 +26,6 @@ def reverse_migration(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("servidores", "0010_servidor_sigi"), ] diff --git a/sigi/apps/servidores/migrations/0012_add_user_interlegis.py b/sigi/apps/servidores/migrations/0012_add_user_interlegis.py index 5e092b3..16bbf61 100644 --- a/sigi/apps/servidores/migrations/0012_add_user_interlegis.py +++ b/sigi/apps/servidores/migrations/0012_add_user_interlegis.py @@ -24,7 +24,6 @@ def forwards_migration(apps, schema_editor): class Migration(migrations.Migration): - dependencies = [ ("servidores", "0011_add_servidor_sigi"), ] diff --git a/sigi/apps/utils/filters.py b/sigi/apps/utils/filters.py index eea3233..05efbb1 100644 --- a/sigi/apps/utils/filters.py +++ b/sigi/apps/utils/filters.py @@ -46,7 +46,9 @@ class EmptyFilter(admin.FieldListFilter): f"Field {field.name} cannot be empty nor null" ) - super().__init__(field, request, params, model, model_admin, field_path) + super().__init__( + field, request, params, model, model_admin, field_path + ) def lookups(self): return ( @@ -110,7 +112,9 @@ class RangeFilter(admin.FieldListFilter): self.model_admin = model_admin self.parameter_name = f"{field_path}__range" - super().__init__(field, request, params, model, model_admin, field_path) + super().__init__( + field, request, params, model, model_admin, field_path + ) if self.parameter_name in params: value = params.pop(self.parameter_name) @@ -227,7 +231,9 @@ class DateRangeFilter(admin.FieldListFilter): self.model_admin = model_admin self.lookup_kwargs = [f"{field_path}__gte", f"{field_path}__lte"] - super().__init__(field, request, params, model, model_admin, field_path) + super().__init__( + field, request, params, model, model_admin, field_path + ) form = self.get_date_form(self.used_parameters) if form.is_valid(): diff --git a/sigi/apps/utils/migrations/0001_initial.py b/sigi/apps/utils/migrations/0001_initial.py index 871a95c..65b4c64 100644 --- a/sigi/apps/utils/migrations/0001_initial.py +++ b/sigi/apps/utils/migrations/0001_initial.py @@ -5,26 +5,55 @@ import tinymce.models class Migration(migrations.Migration): - initial = True - dependencies = [ - ] + dependencies = [] operations = [ migrations.CreateModel( - name='SigiAlert', + name="SigiAlert", fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('caminho', models.CharField(max_length=200, verbose_name='caminho da tela')), - ('destinatarios', models.CharField(choices=[('A', 'Todo e qualquer usuário'), ('N', 'Usuários anônimos / não autenticados'), ('S', 'Membros da equipe Interlegis'), ('D', 'Administradores do sistema')], max_length=1, verbose_name='destinatários')), - ('titulo', models.CharField(max_length=60, verbose_name='título')), - ('mensagem', tinymce.models.HTMLField(verbose_name='mensagem')), + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "caminho", + models.CharField( + max_length=200, verbose_name="caminho da tela" + ), + ), + ( + "destinatarios", + models.CharField( + choices=[ + ("A", "Todo e qualquer usuário"), + ("N", "Usuários anônimos / não autenticados"), + ("S", "Membros da equipe Interlegis"), + ("D", "Administradores do sistema"), + ], + max_length=1, + verbose_name="destinatários", + ), + ), + ( + "titulo", + models.CharField(max_length=60, verbose_name="título"), + ), + ( + "mensagem", + tinymce.models.HTMLField(verbose_name="mensagem"), + ), ], options={ - 'verbose_name': 'alerta SIGI', - 'verbose_name_plural': 'alertas SIGI', - 'ordering': ('caminho', 'destinatarios'), + "verbose_name": "alerta SIGI", + "verbose_name_plural": "alertas SIGI", + "ordering": ("caminho", "destinatarios"), }, ), ] diff --git a/sigi/apps/utils/mixins.py b/sigi/apps/utils/mixins.py index 9964e59..33dccb9 100644 --- a/sigi/apps/utils/mixins.py +++ b/sigi/apps/utils/mixins.py @@ -63,7 +63,9 @@ class LabeledResourse(resources.ModelResource): fields = self.get_fields() if self.selected_fields: fields = [ - f for f in fields if self.get_field_name(f) in self.selected_fields + f + for f in fields + if self.get_field_name(f) in self.selected_fields ] return fields @@ -82,7 +84,9 @@ class ValueLabeledResource(LabeledResourse): class CartExportMixin(ExportMixin): to_encoding = "utf-8" - import_export_change_list_template = "admin/cart/change_list_cart_export.html" + import_export_change_list_template = ( + "admin/cart/change_list_cart_export.html" + ) export_form_class = ExportFormFields _cart_session_name = None _cart_viewing_name = None @@ -153,7 +157,9 @@ class CartExportMixin(ExportMixin): @csrf_protect_m def add_to_cart(self, request, queryset): if request.POST.get("select_across", "0") == "0": - selected_ids = set(request.POST.getlist(helpers.ACTION_CHECKBOX_NAME, [])) + selected_ids = set( + request.POST.getlist(helpers.ACTION_CHECKBOX_NAME, []) + ) else: selected_ids = set(map(str, queryset.values_list("pk", flat=True))) @@ -167,14 +173,18 @@ class CartExportMixin(ExportMixin): if quant: cart_ids.update(selected_ids) request.session[self._cart_session_name] = list(cart_ids) - self.message_user(request, _("%s itens adicionados no carrinho") % quant) + self.message_user( + request, _("%s itens adicionados no carrinho") % quant + ) else: self.message_user( request, _("Os itens selecionados já estavam no carrinho") ) return HttpResponseRedirect(".") - add_to_cart.short_description = _("Armazenar itens no carrinho para exportar") + add_to_cart.short_description = _( + "Armazenar itens no carrinho para exportar" + ) @csrf_protect_m def remove_from_cart(self, request, queryset): @@ -183,12 +193,16 @@ class CartExportMixin(ExportMixin): return HttpResponseRedirect(".") if request.POST.get("select_across", "0") == "0": - remove_ids = set(request.POST.getlist(helpers.ACTION_CHECKBOX_NAME)) + remove_ids = set( + request.POST.getlist(helpers.ACTION_CHECKBOX_NAME) + ) else: remove_ids = set(map(str, queryset.values_list("pk", flat=True))) cart_ids = set(request.session[self._cart_session_name]) - request.session[self._cart_session_name] = list(cart_ids.difference(remove_ids)) + request.session[self._cart_session_name] = list( + cart_ids.difference(remove_ids) + ) self.message_user( request, @@ -269,10 +283,14 @@ class CartExportReportMixin(CartExportMixin): class ReturnMixin: _return_path = None - def changeform_view(self, request, object_id=None, form_url="", extra_context=None): + def changeform_view( + self, request, object_id=None, form_url="", extra_context=None + ): if "_return" in request.GET: self._return_path = request.GET.get("_return") - return super().changeform_view(request, object_id, form_url, extra_context) + return super().changeform_view( + request, object_id, form_url, extra_context + ) def response_post_save_add(self, request, obj): if self._return_path: diff --git a/sigi/apps/whois/views.py b/sigi/apps/whois/views.py index 8548d1d..c0067b2 100644 --- a/sigi/apps/whois/views.py +++ b/sigi/apps/whois/views.py @@ -89,7 +89,9 @@ def whois_query(request, dominio): resposta_dic["modified"] = unicode(s.data_alteracao) resposta_dic["tech-name"] = s.contato_tecnico.nome resposta_dic["tech-email"] = s.contato_tecnico.email - resposta_dic["tech-modified"] = unicode(s.contato_tecnico.ult_alteracao) + resposta_dic["tech-modified"] = unicode( + s.contato_tecnico.ult_alteracao + ) resposta_dic["admin-name"] = s.contato_administrativo.nome resposta_dic["admin-email"] = s.contato_administrativo.email resposta_dic["admin-modified"] = unicode( diff --git a/sigi/settings.py b/sigi/settings.py index fca0147..70aec83 100644 --- a/sigi/settings.py +++ b/sigi/settings.py @@ -95,7 +95,9 @@ EMAIL_USE_LOCALTIME = env("EMAIL_USE_LOCALTIME", bool, default=False) EMAIL_USE_TLS = env("EMAIL_USE_TLS", bool, default=False) EMAIL_USE_SSL = env("EMAIL_USE_SSL", bool, default=False) EMAIL_TIMEOUT = env("EMAIL_TIMEOUT", int, default=None) -DEFAULT_FROM_EMAIL = env("DEFAULT_FROM_EMAIL", default="sigi@interlegis.leg.br") +DEFAULT_FROM_EMAIL = env( + "DEFAULT_FROM_EMAIL", default="sigi@interlegis.leg.br" +) # Database # https://docs.djangoproject.com/en/4.0/ref/settings/#databases diff --git a/sigi/shortcuts.py b/sigi/shortcuts.py index 9a5ab7d..4e9e7d7 100644 --- a/sigi/shortcuts.py +++ b/sigi/shortcuts.py @@ -36,7 +36,9 @@ def pdf_renderer(template, context, filename="report.pdf"): pdf = pisa.CreatePDF(html, dest=response, link_callback=fetch_resources) if pdf.err: - return HttpResponse(_("We had some errors
%s
") % escape(html)) + return HttpResponse( + _("We had some errors
%s
") % escape(html) + ) return response diff --git a/sigi/test_cart.py b/sigi/test_cart.py index f7e1c76..1b8ca2a 100644 --- a/sigi/test_cart.py +++ b/sigi/test_cart.py @@ -31,7 +31,6 @@ from sigi.testutils import pdf_text def test_add_to_cart( url, some_entries, form_action, name_attr, verbose_name_plural, app ): - a, b, c = some_entries() res = app.get(url) @@ -77,7 +76,6 @@ def test_add_to_cart( def test_no_selection_brings_everyone_to_the_cart( url, some_entries, all_expression, app ): - some_entries() res = app.get(url + "carrinho/") diff --git a/sigi/testutils.py b/sigi/testutils.py index ca546d6..e48ec7f 100644 --- a/sigi/testutils.py +++ b/sigi/testutils.py @@ -16,7 +16,6 @@ def pdf_text(res): class SigiDataFixture(SequentialDataFixture): - alphabet = string.ascii_uppercase def __init__(self):