From f259f5e84968b858a9195d1cb395795e3646ff1a Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Tue, 2 May 2017 17:17:10 -0300 Subject: [PATCH] Fix #1060 --- sapl/materia/models.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sapl/materia/models.py b/sapl/materia/models.py index cf8e53d8b..b5390f3b4 100644 --- a/sapl/materia/models.py +++ b/sapl/materia/models.py @@ -685,9 +685,19 @@ class Proposicao(models.Model): ) def __str__(self): - return '%s %s/%s' % (Proposicao._meta.verbose_name, - self.numero_proposicao, - self.ano) + if self.ano and self.numero_proposicao: + return '%s %s/%s' % (Proposicao._meta.verbose_name, + self.numero_proposicao, + self.ano) + else: + if len(self.descricao) < 30: + descricao = self.descricao[:28] + ' ...' + else: + descricao = self.descricao + + return '%s %s/%s' % (Proposicao._meta.verbose_name, + self.id, + descricao) def delete(self, using=None, keep_parents=False): if self.texto_original: