From 2bab1bd6f6cc14425a83017b781aef2733915721 Mon Sep 17 00:00:00 2001 From: Cesar Carvalho Date: Tue, 6 Nov 2018 17:15:00 -0200 Subject: [PATCH] correcao no retorno da data em models de materia --- sapl/materia/models.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sapl/materia/models.py b/sapl/materia/models.py index 1f2667780..6f322c09c 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -263,12 +263,13 @@ class MateriaLegislativa(models.Model): if self.ano and self.numero_protocolo: protocolo = Protocolo.objects.filter( ano=self.ano, - numero=self.numero_protocolo) - if protocolo.first().timestamp: - return protocolo.first().timestamp.date() - else: - return protocolo.data - else: + numero=self.numero_protocolo).first() + if protocolo: + if protocolo.timestamp: + return protocolo.timestamp.date() + elif protocolo.data: + return protocolo.data + return '' def delete(self, using=None, keep_parents=False):