Browse Source

Add ad hoc script to batch update parliaments' managers

producao
Marcio Mazza 10 years ago
parent
commit
ecd5d0f873
  1. 5593
      scripts/setgerentes/dados_gerentes.py
  2. 16
      scripts/setgerentes/set_gerentes.py

5593
scripts/setgerentes/dados_gerentes.py

File diff suppressed because it is too large

16
scripts/setgerentes/set_gerentes.py

@ -0,0 +1,16 @@
# -*- 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()
Loading…
Cancel
Save