|
|
@ -82,11 +82,13 @@ def get_tipos_norma(): |
|
|
|
+ [(n.id, n.descricao) |
|
|
|
for n in TipoNormaJuridica.objects.all()] |
|
|
|
|
|
|
|
|
|
|
|
def get_esferas(): |
|
|
|
return [('E', 'Estadual'), |
|
|
|
('F', 'Federal'), |
|
|
|
('M', 'Municipal')] |
|
|
|
|
|
|
|
|
|
|
|
def get_tipos_materia(): |
|
|
|
return [('', 'Selecione')] \ |
|
|
|
+ [(t.id, t.sigla + ' - ' + t.descricao) |
|
|
@ -98,11 +100,12 @@ class HorizontalRadioRenderer(forms.RadioSelect.renderer): |
|
|
|
def render(self): |
|
|
|
return mark_safe(u' '.join([u'%s ' % w for w in self])) |
|
|
|
|
|
|
|
|
|
|
|
class NormaJuridicaForm(forms.Form): |
|
|
|
|
|
|
|
tipo = forms.ChoiceField(required=True, |
|
|
|
label='Tipo', |
|
|
|
choices= get_tipos_norma(), |
|
|
|
choices=get_tipos_norma(), |
|
|
|
widget=forms.Select( |
|
|
|
attrs={'class': 'selector'})) |
|
|
|
|
|
|
@ -111,58 +114,64 @@ class NormaJuridicaForm(forms.Form): |
|
|
|
ano = forms.CharField(label='Ano', required=True) |
|
|
|
|
|
|
|
data = forms.DateField(label='Data', |
|
|
|
required=True, |
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
required=True, |
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
esfera = forms.ChoiceField(required=True, |
|
|
|
label='Tipo', |
|
|
|
choices=get_esferas(), |
|
|
|
widget=forms.Select( |
|
|
|
attrs={'class': 'selector'})) |
|
|
|
label='Tipo', |
|
|
|
choices=get_esferas(), |
|
|
|
widget=forms.Select( |
|
|
|
attrs={'class': 'selector'})) |
|
|
|
|
|
|
|
complementar = forms.ChoiceField(required=False, |
|
|
|
choices=[('1', 'Sim'), ('0', 'Não')], |
|
|
|
widget=forms.RadioSelect( |
|
|
|
renderer=HorizontalRadioRenderer), |
|
|
|
label='Complementar') |
|
|
|
choices=[('1', 'Sim'), ('0', 'Não')], |
|
|
|
widget=forms.RadioSelect( |
|
|
|
renderer=HorizontalRadioRenderer), |
|
|
|
label='Complementar') |
|
|
|
|
|
|
|
materia = forms.ChoiceField(required=False, |
|
|
|
label='Materia Legislativa', |
|
|
|
choices=get_tipos_materia(), |
|
|
|
widget=forms.Select( |
|
|
|
attrs={'class': 'selector'})) |
|
|
|
label='Materia Legislativa', |
|
|
|
choices=get_tipos_materia(), |
|
|
|
widget=forms.Select( |
|
|
|
attrs={'class': 'selector'})) |
|
|
|
|
|
|
|
numero_materia = forms.CharField(label='Número', required=False) |
|
|
|
|
|
|
|
ano_materia = forms.CharField(label='Ano', required=False) |
|
|
|
ano_materia = forms.CharField(label='Ano', required=False) |
|
|
|
|
|
|
|
data_publicacao = forms.DateField(label='Data Publicação', |
|
|
|
required=False, |
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
required=False, |
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
veiculo_publicacao = forms.CharField(label='Veiculo Publicação', required=False) |
|
|
|
veiculo_publicacao = forms.CharField( |
|
|
|
label='Veiculo Publicação', required=False) |
|
|
|
|
|
|
|
pg_inicio = forms.CharField(label='Pg. Início', required=False) |
|
|
|
|
|
|
|
pg_fim = forms.CharField(label='Pg. Fim', required=False) |
|
|
|
|
|
|
|
# texto = form.FileUpload(label='Texto', required=False) # TODO: implement file upload |
|
|
|
# texto = form.FileUpload(label='Texto', required=False) # TODO: implement |
|
|
|
# file upload |
|
|
|
|
|
|
|
data_fim_vigencia = forms.DateField(label='Data Fim Vigência', |
|
|
|
required=False, |
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
|
|
|
|
data_fim_vigencia = forms.DateField(label='Data Fim Vigência', |
|
|
|
required=False, |
|
|
|
input_formats=['%d/%m/%Y'], |
|
|
|
widget=forms.TextInput( |
|
|
|
attrs={'class': 'dateinput'})) |
|
|
|
ementa = forms.CharField( |
|
|
|
label='Ementa', required=True, widget=forms.Textarea) |
|
|
|
|
|
|
|
ementa = forms.CharField(label='Ementa', required=True, widget=forms.Textarea) |
|
|
|
indexacao = forms.CharField( |
|
|
|
label='Indexação', required=False, widget=forms.Textarea) |
|
|
|
|
|
|
|
indexacao = forms.CharField(label='Indexação', required=False, widget=forms.Textarea) |
|
|
|
observacao = forms.CharField( |
|
|
|
label='Observação', required=False, widget=forms.Textarea) |
|
|
|
|
|
|
|
observacao = forms.CharField(label='Observação', required=False, widget=forms.Textarea) |
|
|
|
|
|
|
|
class NormaIncluirView(FormMixin, GenericView): |
|
|
|
template_name = "norma/normajuridica_incluir.html" |
|
|
@ -181,14 +190,16 @@ class NormaIncluirView(FormMixin, GenericView): |
|
|
|
if form.is_valid(): |
|
|
|
|
|
|
|
norma = NormaJuridica() |
|
|
|
norma.tipo = TipoNormaJuridica.objects.get(id=form.cleaned_data['tipo']) |
|
|
|
norma.tipo = TipoNormaJuridica.objects.get( |
|
|
|
id=form.cleaned_data['tipo']) |
|
|
|
norma.numero = form.cleaned_data['numero'] |
|
|
|
norma.ano = form.cleaned_data['ano'] |
|
|
|
norma.data = form.cleaned_data['data'] |
|
|
|
norma.esfera = form.cleaned_data['esfera'] |
|
|
|
norma.complementar = form.cleaned_data['complementar'] |
|
|
|
if form.cleaned_data['complementar']: |
|
|
|
norma.complementar = TipoMateriaLegislativa.objects.get(id=form.cleaned_data['complementar']) |
|
|
|
norma.complementar = TipoMateriaLegislativa.objects.get( |
|
|
|
id=form.cleaned_data['complementar']) |
|
|
|
|
|
|
|
if form.cleaned_data['materia']: |
|
|
|
norma.materia = form.cleaned_data['materia'] |
|
|
@ -203,7 +214,8 @@ class NormaIncluirView(FormMixin, GenericView): |
|
|
|
norma.data_publicacao = form.cleaned_data['data_publicacao'] |
|
|
|
|
|
|
|
if form.cleaned_data['veiculo_publicacao']: |
|
|
|
norma.veiculo_publicacao = form.cleaned_data['veiculo_publicacao'] |
|
|
|
norma.veiculo_publicacao = form.cleaned_data[ |
|
|
|
'veiculo_publicacao'] |
|
|
|
|
|
|
|
if form.cleaned_data['pg_inicio']: |
|
|
|
norma.pg_inicio = form.cleaned_data['pg_inicio'] |
|
|
@ -212,7 +224,8 @@ class NormaIncluirView(FormMixin, GenericView): |
|
|
|
norma.pg_fim = form.cleaned_data['pg_fim'] |
|
|
|
|
|
|
|
if form.cleaned_data['data_fim_vigencia']: |
|
|
|
norma.data_fim_vigencia = form.cleaned_data['data_fim_vigencia'] |
|
|
|
norma.data_fim_vigencia = form.cleaned_data[ |
|
|
|
'data_fim_vigencia'] |
|
|
|
|
|
|
|
norma.ementa = form.cleaned_data['ementa'] |
|
|
|
|
|
|
|