Browse Source

HOT-FIX: adiciona o cascade models filhos dm parlamentar

pull/1663/head
Edward Ribeiro 7 years ago
parent
commit
09d2f9bdbc
  1. 31
      sapl/parlamentares/migrations/0019_auto_20180221_1155.py
  2. 6
      sapl/parlamentares/models.py

31
sapl/parlamentares/migrations/0019_auto_20180221_1155.py

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2018-02-21 14:55
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('parlamentares', '0018_auto_20180215_1015'),
]
operations = [
migrations.AlterField(
model_name='dependente',
name='parlamentar',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Parlamentar'),
),
migrations.AlterField(
model_name='filiacao',
name='parlamentar',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Parlamentar'),
),
migrations.AlterField(
model_name='mandato',
name='parlamentar',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='parlamentares.Parlamentar'),
),
]

6
sapl/parlamentares/models.py

@ -351,7 +351,7 @@ class Dependente(models.Model):
tipo = models.ForeignKey(TipoDependente, on_delete=models.PROTECT,
verbose_name=_('Tipo'))
parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT)
parlamentar = models.ForeignKey(Parlamentar, on_delete=models.CASCADE)
nome = models.CharField(max_length=150, verbose_name=_('Nome'))
sexo = models.CharField(
max_length=1, verbose_name=_('Sexo'), choices=SEXO_CHOICE)
@ -377,7 +377,7 @@ class Dependente(models.Model):
@reversion.register()
class Filiacao(models.Model):
data = models.DateField(verbose_name=_('Data Filiação'))
parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT)
parlamentar = models.ForeignKey(Parlamentar, on_delete=models.CASCADE)
partido = models.ForeignKey(Partido,
on_delete=models.PROTECT,
verbose_name=_('Partido'))
@ -417,7 +417,7 @@ class TipoAfastamento(models.Model):
@reversion.register()
class Mandato(models.Model):
parlamentar = models.ForeignKey(Parlamentar, on_delete=models.PROTECT)
parlamentar = models.ForeignKey(Parlamentar, on_delete=models.CASCADE)
tipo_afastamento = models.ForeignKey(
TipoAfastamento, blank=True, null=True, on_delete=models.PROTECT)
legislatura = models.ForeignKey(Legislatura, on_delete=models.PROTECT,

Loading…
Cancel
Save