From 4285644b648aba8d97451be47f7a9a4c5fab2073 Mon Sep 17 00:00:00 2001 From: VictorFabreF Date: Mon, 30 Jul 2018 16:35:26 -0300 Subject: [PATCH] HOT-FIX --- sapl/norma/views.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sapl/norma/views.py b/sapl/norma/views.py index 9da8f24bc..b364e95bd 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -1,4 +1,5 @@ +import re import weasyprint from django.contrib.auth.mixins import PermissionRequiredMixin from django.core.exceptions import ObjectDoesNotExist @@ -206,12 +207,8 @@ def recuperar_numero_norma(request): norma = NormaJuridica.objects.filter(**param).order_by( 'tipo', 'ano').values_list('numero', 'ano').last() if norma: - try: - response = JsonResponse({'numero': int(norma[0]) + 1, + response = JsonResponse({'numero': int(re.sub("[^0-9].*", '', norma[0])) + 1, 'ano': norma[1]}) - except ValueError: - response = JsonResponse({'numero': int(norma[0][0:-1]) + 1, - 'ano': norma[1]}) else: response = JsonResponse( {'numero': 1, 'ano': ano})