Browse Source

Fix #836

pull/845/head
LeandroRoberto 8 years ago
parent
commit
3d77915654
  1. 8
      sapl/materia/views.py
  2. 10
      sapl/norma/forms.py

8
sapl/materia/views.py

@ -21,7 +21,6 @@ from django.views.generic.base import RedirectView
from django.views.generic.edit import FormView
from django_filters.views import FilterView
import sapl
from sapl.base.models import Autor, CasaLegislativa
from sapl.compilacao.models import (STATUS_TA_EDITION,
STATUS_TA_IMMUTABLE_RESTRICT,
@ -40,6 +39,7 @@ from sapl.protocoloadm.models import Protocolo
from sapl.utils import (TURNO_TRAMITACAO_CHOICES, YES_NO_CHOICES, autor_label,
autor_modal, gerar_hash_arquivo, get_base_url,
montar_row_autor)
import sapl
from .forms import (AcessorioEmLoteFilterSet, AcompanhamentoMateriaForm,
DocumentoAcessorioForm, MateriaLegislativaFilterSet,
@ -55,6 +55,7 @@ from .models import (AcompanhamentoMateria, Anexada, Autoria, DespachoInicial,
TipoMateriaLegislativa, TipoProposicao, Tramitacao,
UnidadeTramitacao)
OrigemCrud = Crud.build(Origem, '')
TipoMateriaCrud = CrudAux.build(
@ -987,6 +988,11 @@ class MateriaLegislativaCrud(Crud):
def cancel_url(self):
return self.search_url
class DeleteView(Crud.DeleteView):
def get_success_url(self):
return self.search_url
class ListView(Crud.ListView, RedirectView):
def get_redirect_url(self, *args, **kwargs):

10
sapl/norma/forms.py

@ -1,6 +1,5 @@
from datetime import datetime
import django_filters
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Fieldset, Layout
from django import forms
@ -8,6 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.forms import ModelForm, widgets
from django.utils.translation import ugettext_lazy as _
import django_filters
from sapl.crispy_layout_mixin import form_actions, to_row
from sapl.materia.models import MateriaLegislativa, TipoMateriaLegislativa
@ -50,6 +50,9 @@ class NormaFilterSet(django_filters.FilterSet):
ementa = django_filters.CharFilter(lookup_expr='icontains')
assuntos = django_filters.ModelChoiceFilter(
queryset=AssuntoNorma.objects.all())
class Meta:
model = NormaJuridica
fields = ['tipo', 'numero', 'ano', 'data',
@ -60,14 +63,13 @@ class NormaFilterSet(django_filters.FilterSet):
row1 = to_row([('tipo', 4), ('numero', 4), ('ano', 4)])
row2 = to_row([('data', 6), ('data_publicacao', 6)])
row3 = to_row([('ementa', 12)])
row4 = to_row([('assuntos', 12)])
row3 = to_row([('ementa', 8), ('assuntos', 4)])
self.form.helper = FormHelper()
self.form.helper.form_method = 'GET'
self.form.helper.layout = Layout(
Fieldset(_('Pesquisa de Norma'),
row1, row2, row3, row4,
row1, row2, row3,
form_actions(save_label='Pesquisar'))
)

Loading…
Cancel
Save