From 4d4d4278f986a84c868b2359dd31f78d1b7a6535 Mon Sep 17 00:00:00 2001 From: Talitha Pumar Date: Mon, 6 Aug 2018 14:39:31 -0300 Subject: [PATCH] Fix #2104 (#2110) Co-authored-by: Edward Ribeiro --- sapl/norma/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapl/norma/views.py b/sapl/norma/views.py index b364e95bd..f5fecdefc 100644 --- a/sapl/norma/views.py +++ b/sapl/norma/views.py @@ -72,7 +72,7 @@ class NormaPesquisaView(FilterView): def get_queryset(self): qs = super().get_queryset() - qs.select_related('tipo', 'materia') + qs = qs.extra({'norma_i': "CAST(regexp_replace(numero,'[^0-9]','', 'g') AS INTEGER)", 'norma_letra': "regexp_replace(numero,'[^a-zA-Z]','', 'g')"}).order_by('-data', '-norma_i', '-norma_letra') return qs