Browse Source

Correct improperly Servico cascade deletion when Funcionario was removed

pull/11/head
Sesostris Vieira 8 years ago
parent
commit
1f03796a66
  1. 27
      sigi/apps/servicos/migrations/0003_auto_20170407_1003.py
  2. 4
      sigi/apps/servicos/models.py

27
sigi/apps/servicos/migrations/0003_auto_20170407_1003.py

@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('servicos', '0002_tiposervico_modo'),
]
operations = [
migrations.AlterField(
model_name='servico',
name='contato_administrativo',
field=models.ForeignKey(related_name='contato_administrativo', on_delete=django.db.models.deletion.PROTECT, verbose_name='Contato administrativo', to='casas.Funcionario'),
preserve_default=True,
),
migrations.AlterField(
model_name='servico',
name='contato_tecnico',
field=models.ForeignKey(related_name='contato_tecnico', on_delete=django.db.models.deletion.PROTECT, verbose_name='Contato t\xe9cnico', to='casas.Funcionario'),
preserve_default=True,
),
]

4
sigi/apps/servicos/models.py

@ -39,8 +39,8 @@ class TipoServico(models.Model):
class Servico(models.Model): class Servico(models.Model):
casa_legislativa = models.ForeignKey(CasaLegislativa, verbose_name=_(u'Casa Legislativa')) casa_legislativa = models.ForeignKey(CasaLegislativa, verbose_name=_(u'Casa Legislativa'))
tipo_servico = models.ForeignKey(TipoServico, verbose_name=_(u'Tipo de serviço')) tipo_servico = models.ForeignKey(TipoServico, verbose_name=_(u'Tipo de serviço'))
contato_tecnico = models.ForeignKey(Funcionario, verbose_name=_(u'Contato técnico'), related_name='contato_tecnico') contato_tecnico = models.ForeignKey(Funcionario, verbose_name=_(u'Contato técnico'), related_name='contato_tecnico', on_delete=models.PROTECT)
contato_administrativo = models.ForeignKey(Funcionario, verbose_name=_(u'Contato administrativo'), related_name='contato_administrativo') contato_administrativo = models.ForeignKey(Funcionario, verbose_name=_(u'Contato administrativo'), related_name='contato_administrativo', on_delete=models.PROTECT)
url = models.URLField(_(u'URL do serviço'), blank=True) url = models.URLField(_(u'URL do serviço'), blank=True)
hospedagem_interlegis = models.BooleanField(_(u'Hospedagem no Interlegis?'), default=False) hospedagem_interlegis = models.BooleanField(_(u'Hospedagem no Interlegis?'), default=False)
nome_servidor = models.CharField(_(u'Hospedado em'), max_length=60, blank=True, nome_servidor = models.CharField(_(u'Hospedado em'), max_length=60, blank=True,

Loading…
Cancel
Save