From c69fc425a0c4f118d8d428c89374bad6fe4c21f4 Mon Sep 17 00:00:00 2001 From: LeandroRoberto Date: Mon, 12 Jun 2017 11:44:21 -0300 Subject: [PATCH] =?UTF-8?q?Refatora=20c=C3=B3digo=20de=20exclus=C3=A3o=20d?= =?UTF-8?q?e=20mat=C3=A9ria?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/materia/models.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 557273136..6b02f2f14 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -248,11 +248,9 @@ class MateriaLegislativa(models.Model): if self.texto_original: self.texto_original.delete() - proposicao = self.proposicao.all() - if proposicao: - for p in proposicao: - p.conteudo_gerado_related = None - p.save() + for p in self.proposicao.all(): + p.conteudo_gerado_related = None + p.save() return models.Model.delete( self, using=using, keep_parents=keep_parents) @@ -432,11 +430,9 @@ class DocumentoAcessorio(models.Model): if self.arquivo: self.arquivo.delete() - proposicao = self.proposicao.all() - if proposicao: - for p in proposicao: - p.conteudo_gerado_related = None - p.save() + for p in self.proposicao.all(): + p.conteudo_gerado_related = None + p.save() return models.Model.delete( self, using=using, keep_parents=keep_parents)