From 608f4e95817d8c40f53fc00d156bda23e9793fb2 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Fri, 22 Apr 2016 08:22:47 -0300 Subject: [PATCH] Reaproveita codido de pesquisa de materia --- protocoloadm/forms.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/protocoloadm/forms.py b/protocoloadm/forms.py index 21d4f99db..93fa70b3e 100644 --- a/protocoloadm/forms.py +++ b/protocoloadm/forms.py @@ -11,6 +11,7 @@ from django.utils.translation import ugettext_lazy as _ import crispy_layout_mixin import sapl from crispy_layout_mixin import form_actions +from materia.forms import RangeWidgetOverride from materia.models import Autor from sapl.utils import RANGE_ANOS @@ -28,27 +29,6 @@ NATUREZA_PROCESSO = [('0', 'Administrativo'), ANO_CHOICES = [('', '---------')] + RANGE_ANOS -# Importar essa classe de materias.views quando for feito o Merge do branch 217 -class RangeWidgetOverride(forms.MultiWidget): - - def __init__(self, attrs=None): - widgets = (forms.DateInput(format='%d/%m/%Y', - attrs={'class': 'dateinput', - 'placeholder': 'Inicial'}), - forms.DateInput(format='%d/%m/%Y', - attrs={'class': 'dateinput', - 'placeholder': 'Final'})) - super(RangeWidgetOverride, self).__init__(widgets, attrs) - - def decompress(self, value): - if value: - return [value.start, value.stop] - return [None, None] - - def format_output(self, rendered_widgets): - return ''.join(rendered_widgets) - - class ProtocoloFilterSet(django_filters.FilterSet): filter_overrides = {models.DateField: {