|
|
@ -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')) |
|
|
|
) |
|
|
|
|
|
|
|