Repository: interlegis/sapl

Issue:
Adicionar campo Natureza de Processo na Pesquisa de Protocolo
A coluna é tipo_processo

0 - Adm
1 - Leg
'' - Ambos



Discussion:

Resolving patch:
diff --git a/compilacao/views.py b/compilacao/views.py
--- a/compilacao/views.py
+++ b/compilacao/views.py
@@ -1,12 +1,11 @@
+import sys
 from collections import OrderedDict
 from datetime import datetime, timedelta
-import sys
 
 from braces.views import FormMessagesMixin
 from django import forms
 from django.contrib.auth.decorators import login_required
 from django.contrib.contenttypes.models import ContentType
-from django.contrib.messages import constants
 from django.core.signing import Signer
 from django.core.urlresolvers import reverse_lazy
 from django.db import transaction
@@ -19,8 +18,8 @@
 from django.utils.translation import ugettext_lazy as _
 from django.views.generic.base import TemplateView
 from django.views.generic.detail import DetailView
-from django.views.generic.edit import (CreateView, DeleteView, FormView,
-                                       UpdateView, FormMixin)
+from django.views.generic.edit import (CreateView, DeleteView,
+                                       FormView, UpdateView)
 from django.views.generic.list import ListView
 
 from compilacao.forms import (DispositivoDefinidorVigenciaForm,
@@ -28,8 +27,8 @@
                               DispositivoEdicaoBasicaForm,
                               DispositivoEdicaoVigenciaForm,
                               DispositivoSearchModalForm, NotaForm,
-                              PublicacaoForm, TaForm, TipoTaForm, VideForm,
-                              TextNotificacoesForm)
+                              PublicacaoForm, TaForm, TextNotificacoesForm,
+                              TipoTaForm, VideForm)
 from compilacao.models import (Dispositivo, Nota,
                                PerfilEstruturalTextoArticulado, Publicacao,
                                TextoArticulado, TipoDispositivo, TipoNota,
@@ -38,7 +37,6 @@
 from compilacao.utils import DISPOSITIVO_SELECT_RELATED
 from crud.base import Crud, CrudListView, make_pagination
 
-
 TipoNotaCrud = Crud.build(TipoNota, 'tipo_nota')
 TipoVideCrud = Crud.build(TipoVide, 'tipo_vide')
 TipoPublicacaoCrud = Crud.build(TipoPublicacao, 'tipo_publicacao')
diff --git a/protocoloadm/forms.py b/protocoloadm/forms.py
--- a/protocoloadm/forms.py
+++ b/protocoloadm/forms.py
@@ -21,9 +21,9 @@
 
 TIPOS_PROTOCOLO = [('0', 'Enviado'), ('1', 'Recebido'), ('', 'Ambos')]
 
-NATUREZA_PROCESSO = [('0', 'Administrativo'),
-                     ('1', 'Legislativo'),
-                     ('', 'Ambos')]
+NATUREZA_PROCESSO = [('', 'Ambos'),
+                     ('0', 'Administrativo'),
+                     ('1', 'Legislativo')]
 
 
 ANO_CHOICES = [('', '---------')] + RANGE_ANOS
@@ -53,6 +53,11 @@ class ProtocoloFilterSet(django_filters.FilterSet):
                                                  choices=TIPOS_PROTOCOLO,
                                                  widget=forms.Select(
                                                   attrs={'class': 'selector'}))
+    tipo_processo = django_filters.ChoiceFilter(required=False,
+                                                label='Natureza do Processo',
+                                                choices=NATUREZA_PROCESSO,
+                                                widget=forms.Select(
+                                                  attrs={'class': 'selector'}))
 
     class Meta:
         model = Protocolo
@@ -115,6 +120,8 @@ def __init__(self, *args, **kwargs):
                           'Limpar Autor',
                           css_class='btn btn-primary btn-sm'), 10)])
         row5 = crispy_layout_mixin.to_row(
+            [('tipo_processo', 12)])
+        row6 = crispy_layout_mixin.to_row(
             [('o', 12)])
 
         self.form.helper = FormHelper()
@@ -125,7 +132,7 @@ def __init__(self, *args, **kwargs):
                      row3,
                      HTML(sapl.utils.autor_label),
                      HTML(sapl.utils.autor_modal),
-                     row4, row5,
+                     row4, row5, row6,
                      form_actions(save_label='Pesquisar'))
             )
 


Test patch: