diff --git a/sigi/apps/contatos/models.py b/sigi/apps/contatos/models.py index 200095f..6a6f217 100644 --- a/sigi/apps/contatos/models.py +++ b/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') diff --git a/sigi/apps/inventario/models.py b/sigi/apps/inventario/models.py index 2018769..24ecf6e 100644 --- a/sigi/apps/inventario/models.py +++ b/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, diff --git a/sigi/apps/servicos/models.py b/sigi/apps/servicos/models.py index 3fe7d36..ec1733f 100644 --- a/sigi/apps/servicos/models.py +++ b/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)