Browse Source

Modifica o label de alguns filtros, nos casos em que nao era adequado o Verbose Name

pull/282/head
Eduardo Calil 9 years ago
parent
commit
9510ad6ff2
  1. 15
      materia/forms.py

15
materia/forms.py

@ -6,7 +6,9 @@ from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models from django.db import models
from django.db.models import Max from django.db.models import Max
from django.forms import ModelForm from django.forms import ModelForm
from django.utils.text import capfirst
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django_filters.utils import resolve_field
import crispy_layout_mixin import crispy_layout_mixin
import sapl import sapl
@ -622,15 +624,15 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet):
'widget': RangeWidgetOverride}, 'widget': RangeWidgetOverride},
}} }}
autoria__autor = django_filters.CharFilter(widget=forms.HiddenInput())
ementa = django_filters.CharFilter(lookup_expr='icontains')
ano = django_filters.ChoiceFilter(required=False, ano = django_filters.ChoiceFilter(required=False,
label=u'Ano da Matéria', label=u'Ano da Matéria',
choices=ANO_CHOICES, choices=ANO_CHOICES,
help_text="") help_text="")
autoria__autor = django_filters.CharFilter(widget=forms.HiddenInput())
ementa = django_filters.CharFilter(lookup_expr='icontains')
class Meta: class Meta:
model = MateriaLegislativa model = MateriaLegislativa
fields = ['numero', fields = ['numero',
@ -674,6 +676,11 @@ class MateriaLegislativaFilterSet(django_filters.FilterSet):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(MateriaLegislativaFilterSet, self).__init__(*args, **kwargs) super(MateriaLegislativaFilterSet, self).__init__(*args, **kwargs)
self.filters['tipo'].label = 'Tipo de Matéria'
self.filters['autoria__autor__tipo'].label = 'Tipo de Autor'
self.filters['autoria__partido'].label = 'Partido do Autor'
self.filters['relatoria__parlamentar_id'].label = 'Relatoria'
row1 = crispy_layout_mixin.to_row( row1 = crispy_layout_mixin.to_row(
[('tipo', 12)]) [('tipo', 12)])
row2 = crispy_layout_mixin.to_row( row2 = crispy_layout_mixin.to_row(

Loading…
Cancel
Save