Browse Source

Tornar on_delete explícito em todos os models

pull/66/head
Sesostris Vieira 4 years ago
parent
commit
cbd25078e7
  1. 21
      sigi/apps/contatos/models.py
  2. 5
      sigi/apps/inventario/models.py
  3. 2
      sigi/apps/servicos/models.py

21
sigi/apps/contatos/models.py

@ -190,10 +190,13 @@ class Telefone(models.Model):
ult_alteracao = models.DateTimeField(_(u'Última alteração'), null=True, blank=True, editable=False, auto_now=True)
# guarda o tipo do objeto (classe) vinculado a esse registro
content_type = models.ForeignKey(ContentType)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
# identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
content_object = generic.GenericForeignKey(
'content_type',
'object_id',
)
class Meta:
ordering = ('numero',)
@ -224,10 +227,13 @@ class Contato(models.Model):
)
# guarda o tipo do objeto (classe) vinculado a esse registro
content_type = models.ForeignKey(ContentType)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
# identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
content_object = generic.GenericForeignKey(
'content_type',
'object_id',
)
class Meta:
ordering = ('nome',)
@ -317,10 +323,13 @@ class Endereco(models.Model):
municipio.uf_filter = True
# guarda o tipo do objeto (classe) vinculado a esse registro
content_type = models.ForeignKey(ContentType)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
# identificador do registro na classe vinculado a esse registro
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
content_object = generic.GenericForeignKey(
'content_type',
'object_id',
)
class Meta:
ordering = ('logradouro', 'numero')

5
sigi/apps/inventario/models.py

@ -84,10 +84,7 @@ class Bem(models.Model):
on_delete=models.CASCADE
)
equipamento = models.ForeignKey(Equipamento, on_delete=models.CASCADE)
fornecedor = models.ForeignKey(
Fornecedor,
on_delete=models.PROTECT
)
fornecedor = models.ForeignKey(Fornecedor, on_delete=models.PROTECT)
num_serie = models.CharField(
_(u'número de série'),
max_length=64,

2
sigi/apps/servicos/models.py

@ -215,7 +215,7 @@ class CasaAtendida(Orgao):
class CasaManifesta(models.Model):
casa_legislativa = models.OneToOneField(Orgao)
casa_legislativa = models.OneToOneField(Orgao, on_delete=models.CASCADE)
data_manifestacao = models.DateTimeField(auto_now_add=True)
data_atualizacao = models.DateTimeField(auto_now=True)
informante = models.CharField(_(u'Nome do informante'), max_length=100, blank=True)

Loading…
Cancel
Save