mirror of https://github.com/interlegis/sapl.git
committed by
João Rodrigues
3 changed files with 59 additions and 16 deletions
@ -1,16 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
# Generated by Django 1.11.20 on 2019-10-30 19:55 |
|
||||
from __future__ import unicode_literals |
|
||||
|
|
||||
from django.db import migrations |
|
||||
|
|
||||
|
|
||||
class Migration(migrations.Migration): |
|
||||
|
|
||||
dependencies = [ |
|
||||
('base', '0038_auditlog'), |
|
||||
('base', '0039_auto_20190913_1228'), |
|
||||
] |
|
||||
|
|
||||
operations = [ |
|
||||
] |
|
||||
@ -0,0 +1,29 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.11.25 on 2019-11-12 15:05 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations |
||||
|
from datetime import date |
||||
|
|
||||
|
def popula_cargoFrente_inicial(apps, schema_editor): |
||||
|
CargoFrente = apps.get_model('parlamentares', 'CargoFrente') |
||||
|
|
||||
|
cargoFrenteMembro = CargoFrente() |
||||
|
cargoFrenteMembro.nome_cargo = 'Membro' |
||||
|
cargoFrenteMembro.cargo_unico = False |
||||
|
cargoFrenteMembro.save() |
||||
|
|
||||
|
cargoFrentePresidente = CargoFrente() |
||||
|
cargoFrentePresidente.nome_cargo = 'Presidente' |
||||
|
cargoFrentePresidente.cargo_unico = True |
||||
|
cargoFrentePresidente.save() |
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('parlamentares', '0038_auto_20191025_1142'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunPython(popula_cargoFrente_inicial) |
||||
|
] |
||||
@ -0,0 +1,30 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
# Generated by Django 1.11.25 on 2019-11-12 15:05 |
||||
|
from __future__ import unicode_literals |
||||
|
|
||||
|
from django.db import migrations |
||||
|
from datetime import date |
||||
|
|
||||
|
def transfere_parlamentar_frente(apps, schema_editor): |
||||
|
Frente = apps.get_model('parlamentares', 'Frente') |
||||
|
ParlamentarFrente = apps.get_model('parlamentares', 'ParlamentarFrente') |
||||
|
CargoFrente = apps.get_model('parlamentares', 'CargoFrente') |
||||
|
for frente in Frente.objects.all(): |
||||
|
for parlamentar in frente.parlamentares.all(): |
||||
|
parlamentarFrente = ParlamentarFrente() |
||||
|
parlamentarFrente.frente = frente |
||||
|
parlamentarFrente.parlamentar = parlamentar |
||||
|
parlamentarFrente.cargo = CargoFrente.objects.first() |
||||
|
parlamentarFrente.data_entrada = date.today() |
||||
|
parlamentarFrente.save() |
||||
|
|
||||
|
|
||||
|
class Migration(migrations.Migration): |
||||
|
|
||||
|
dependencies = [ |
||||
|
('parlamentares', '0039_popula_CargoFrente'), |
||||
|
] |
||||
|
|
||||
|
operations = [ |
||||
|
migrations.RunPython(transfere_parlamentar_frente) |
||||
|
] |
||||
Loading…
Reference in new issue