Browse Source

Refatora código de exclusão de matéria

pull/1190/head
LeandroRoberto 8 years ago
parent
commit
c69fc425a0
  1. 16
      sapl/materia/models.py

16
sapl/materia/models.py

@ -248,11 +248,9 @@ class MateriaLegislativa(models.Model):
if self.texto_original: if self.texto_original:
self.texto_original.delete() self.texto_original.delete()
proposicao = self.proposicao.all() for p in self.proposicao.all():
if proposicao: p.conteudo_gerado_related = None
for p in proposicao: p.save()
p.conteudo_gerado_related = None
p.save()
return models.Model.delete( return models.Model.delete(
self, using=using, keep_parents=keep_parents) self, using=using, keep_parents=keep_parents)
@ -432,11 +430,9 @@ class DocumentoAcessorio(models.Model):
if self.arquivo: if self.arquivo:
self.arquivo.delete() self.arquivo.delete()
proposicao = self.proposicao.all() for p in self.proposicao.all():
if proposicao: p.conteudo_gerado_related = None
for p in proposicao: p.save()
p.conteudo_gerado_related = None
p.save()
return models.Model.delete( return models.Model.delete(
self, using=using, keep_parents=keep_parents) self, using=using, keep_parents=keep_parents)

Loading…
Cancel
Save