|
@ -1,5 +1,6 @@ |
|
|
from datetime import date |
|
|
from datetime import date |
|
|
|
|
|
|
|
|
|
|
|
from crispy_forms.bootstrap import InlineRadios |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import HTML, Button, Field, Fieldset, Layout, Submit |
|
|
from crispy_forms.layout import HTML, Button, Field, Fieldset, Layout, Submit |
|
|
from django import forms |
|
|
from django import forms |
|
@ -30,12 +31,6 @@ def get_range_anos(): |
|
|
+ [(year, year) for year in range(date.today().year, 1960, -1)] |
|
|
+ [(year, year) for year in range(date.today().year, 1960, -1)] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HorizontalRadioRenderer(forms.RadioSelect.renderer): |
|
|
|
|
|
|
|
|
|
|
|
def render(self): |
|
|
|
|
|
return mark_safe(u' '.join([u'%s ' % w for w in self])) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProtocoloForm(forms.Form): |
|
|
class ProtocoloForm(forms.Form): |
|
|
|
|
|
|
|
|
YEARS = get_range_anos() |
|
|
YEARS = get_range_anos() |
|
@ -213,15 +208,11 @@ class ProtocoloDocumentForm(ModelForm): |
|
|
|
|
|
|
|
|
numeracao = forms.ChoiceField(required=True, |
|
|
numeracao = forms.ChoiceField(required=True, |
|
|
choices=NUMERACAO_CHOICES, |
|
|
choices=NUMERACAO_CHOICES, |
|
|
widget=forms.RadioSelect( |
|
|
|
|
|
renderer=HorizontalRadioRenderer), |
|
|
|
|
|
label='') |
|
|
label='') |
|
|
|
|
|
|
|
|
tipo_protocolo = forms.ChoiceField(required=True, |
|
|
tipo_protocolo = forms.ChoiceField(required=True, |
|
|
label=_('Tipo de Protocolo'), |
|
|
label=_('Tipo de Protocolo'), |
|
|
choices=TIPOS_PROTOCOLO, |
|
|
choices=TIPOS_PROTOCOLO,) |
|
|
widget=forms.RadioSelect( |
|
|
|
|
|
renderer=HorizontalRadioRenderer)) |
|
|
|
|
|
|
|
|
|
|
|
tipo_documento = forms.ModelChoiceField( |
|
|
tipo_documento = forms.ModelChoiceField( |
|
|
label=_('Tipo de Documento'), |
|
|
label=_('Tipo de Documento'), |
|
@ -254,9 +245,9 @@ class ProtocoloDocumentForm(ModelForm): |
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
|
|
|
|
row1 = crispy_layout_mixin.to_row( |
|
|
row1 = crispy_layout_mixin.to_row( |
|
|
[('numeracao', 12)]) |
|
|
[(InlineRadios('numeracao'), 12)]) |
|
|
row2 = crispy_layout_mixin.to_row( |
|
|
row2 = crispy_layout_mixin.to_row( |
|
|
[('tipo_protocolo', 12)]) |
|
|
[(InlineRadios('tipo_protocolo'), 12)]) |
|
|
row3 = crispy_layout_mixin.to_row( |
|
|
row3 = crispy_layout_mixin.to_row( |
|
|
[('tipo_documento', 6), |
|
|
[('tipo_documento', 6), |
|
|
('num_paginas', 6)]) |
|
|
('num_paginas', 6)]) |
|
@ -291,15 +282,11 @@ class ProtocoloMateriaForm(ModelForm): |
|
|
|
|
|
|
|
|
numeracao = forms.ChoiceField(required=True, |
|
|
numeracao = forms.ChoiceField(required=True, |
|
|
choices=NUMERACAO_CHOICES, |
|
|
choices=NUMERACAO_CHOICES, |
|
|
widget=forms.RadioSelect( |
|
|
|
|
|
renderer=HorizontalRadioRenderer), |
|
|
|
|
|
label='') |
|
|
label='') |
|
|
|
|
|
|
|
|
tipo_protocolo = forms.ChoiceField(required=True, |
|
|
tipo_protocolo = forms.ChoiceField(required=True, |
|
|
label='Tipo de Protocolo', |
|
|
label='Tipo de Protocolo', |
|
|
choices=TIPOS_PROTOCOLO, |
|
|
choices=TIPOS_PROTOCOLO,) |
|
|
widget=forms.RadioSelect( |
|
|
|
|
|
renderer=HorizontalRadioRenderer)) |
|
|
|
|
|
|
|
|
|
|
|
autor = forms.IntegerField(widget=forms.HiddenInput(), required=False) |
|
|
autor = forms.IntegerField(widget=forms.HiddenInput(), required=False) |
|
|
|
|
|
|
|
@ -325,10 +312,10 @@ class ProtocoloMateriaForm(ModelForm): |
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
|
|
|
|
row1 = crispy_layout_mixin.to_row( |
|
|
row1 = crispy_layout_mixin.to_row( |
|
|
[('numeracao', 12)]) |
|
|
[(InlineRadios('numeracao'), 12)]) |
|
|
row2 = crispy_layout_mixin.to_row( |
|
|
row2 = crispy_layout_mixin.to_row( |
|
|
[('tipo_materia', 4), |
|
|
[('tipo_materia', 4), |
|
|
('tipo_protocolo', 4), |
|
|
(InlineRadios('tipo_protocolo'), 4), |
|
|
('numero_paginas', 4)]) |
|
|
('numero_paginas', 4)]) |
|
|
row3 = crispy_layout_mixin.to_row( |
|
|
row3 = crispy_layout_mixin.to_row( |
|
|
[('autor', 0), |
|
|
[('autor', 0), |
|
|