Sistema de Informações Gerenciais do Interlegis
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
573 B

# -*- coding: utf-8 -*-
from dados_gerentes import atrib, gerentes
from sigi.apps.casas.models import CasaLegislativa
def salvar():
for cod, abrev_gerente in atrib:
casas = CasaLegislativa.objects.filter(municipio__codigo_ibge=cod, tipo__sigla='CM')
if not casas:
print '############################# SEM CASA: ', cod
elif len(casas) > 1:
print '############################# VÁRIAS CASAS: ', cod, casas
else:
[c] = casas
c.gerente_contas = gerentes[abrev_gerente]
c.save()