From 3c8cb03bc6cfafe1214322255cbe0b1a42098e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rog=C3=A9rio=20Fr=C3=A1?= Date: Wed, 18 Jan 2017 08:52:32 -0300 Subject: [PATCH] =?UTF-8?q?Anexo=20Sess=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapl/sessao/models.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sapl/sessao/models.py b/sapl/sessao/models.py index f5b6aab83..eb439b69c 100644 --- a/sapl/sessao/models.py +++ b/sapl/sessao/models.py @@ -160,6 +160,9 @@ class SessaoPlenaria(models.Model): if self.upload_ata: self.upload_ata.delete() + + if self.upload_anexo: + self.upload_anexo.delete() return models.Model.delete( self, using=using, keep_parents=keep_parents) @@ -167,11 +170,13 @@ class SessaoPlenaria(models.Model): def save(self, force_insert=False, force_update=False, using=None, update_fields=None): - if not self.pk and (self.upload_pauta or self.upload_ata): + if not self.pk and (self.upload_pauta or self.upload_ata or self.upload_anexo): upload_pauta = self.upload_pauta upload_ata = self.upload_ata + upload_anexo = self.upload_anexo self.upload_pauta = None self.upload_ata = None + self.upload_anexo = None models.Model.save(self, force_insert=force_insert, force_update=force_update, using=using, @@ -179,6 +184,7 @@ class SessaoPlenaria(models.Model): self.upload_pauta = upload_pauta self.upload_ata = upload_ata + self.upload_anexo = upload_anexo return models.Model.save(self, force_insert=force_insert, force_update=force_update,