|
@ -1,5 +1,5 @@ |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.helper import FormHelper |
|
|
from crispy_forms.layout import ButtonHolder, Fieldset, Layout, Submit |
|
|
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit, MultiField, Div, Field |
|
|
from django import forms |
|
|
from django import forms |
|
|
from django.core.urlresolvers import reverse |
|
|
from django.core.urlresolvers import reverse |
|
|
from django.forms import ModelForm |
|
|
from django.forms import ModelForm |
|
@ -7,6 +7,7 @@ from django.utils.translation import ugettext_lazy as _ |
|
|
from django.views.generic.edit import FormMixin |
|
|
from django.views.generic.edit import FormMixin |
|
|
from vanilla import GenericView |
|
|
from vanilla import GenericView |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import sapl |
|
|
import sapl |
|
|
from parlamentares.models import Filiacao, Parlamentar |
|
|
from parlamentares.models import Filiacao, Parlamentar |
|
|
from sapl.crud import build_crud |
|
|
from sapl.crud import build_crud |
|
@ -35,7 +36,6 @@ tipo_comissao_crud = build_crud( |
|
|
[('nome', 9), ('sigla', 3)], |
|
|
[('nome', 9), ('sigla', 3)], |
|
|
[('dispositivo_regimental', 9), ('natureza', 3)]], |
|
|
[('dispositivo_regimental', 9), ('natureza', 3)]], |
|
|
]) |
|
|
]) |
|
|
|
|
|
|
|
|
comissao_crud = build_crud( |
|
|
comissao_crud = build_crud( |
|
|
Comissao, 'modulo_comissoes', [ |
|
|
Comissao, 'modulo_comissoes', [ |
|
|
|
|
|
|
|
@ -65,6 +65,129 @@ comissao_crud = build_crud( |
|
|
]) |
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CadastrarComissaoForm(ModelForm): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Meta: |
|
|
|
|
|
|
|
|
|
|
|
model = Comissao |
|
|
|
|
|
fields = ['nome', |
|
|
|
|
|
'tipo', |
|
|
|
|
|
'sigla', |
|
|
|
|
|
'data_criacao', |
|
|
|
|
|
'data_extincao', |
|
|
|
|
|
'unidade_deliberativa', |
|
|
|
|
|
|
|
|
|
|
|
'local_reuniao', |
|
|
|
|
|
'agenda_reuniao', |
|
|
|
|
|
'telefone_reuniao', |
|
|
|
|
|
'endereco_secretaria', |
|
|
|
|
|
'telefone_secretaria', |
|
|
|
|
|
'fax_secretaria', |
|
|
|
|
|
'secretario', |
|
|
|
|
|
'email', |
|
|
|
|
|
'finalidade', |
|
|
|
|
|
|
|
|
|
|
|
'apelido_temp', |
|
|
|
|
|
'data_instalacao_temp', |
|
|
|
|
|
'data_final_prevista_temp', |
|
|
|
|
|
'data_prorrogada_temp', |
|
|
|
|
|
'data_fim_comissao'] |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
|
|
|
|
|
|
|
row1 = sapl.layout.to_row( |
|
|
|
|
|
[('nome', 8), |
|
|
|
|
|
('sigla', 4)]) |
|
|
|
|
|
|
|
|
|
|
|
row2 = sapl.layout.to_row( |
|
|
|
|
|
[('tipo', 3), |
|
|
|
|
|
('data_criacao', 3), |
|
|
|
|
|
('unidade_deliberativa',3), |
|
|
|
|
|
('data_extincao',3)]) |
|
|
|
|
|
|
|
|
|
|
|
row3 = sapl.layout.to_row( |
|
|
|
|
|
[('local_reuniao',4), |
|
|
|
|
|
('agenda_reuniao',4), |
|
|
|
|
|
('telefone_reuniao',4)]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
row4 = sapl.layout.to_row( |
|
|
|
|
|
[('endereco_secretaria', 4), |
|
|
|
|
|
('telefone_secretaria', 4), |
|
|
|
|
|
('fax_secretaria', 4)]) |
|
|
|
|
|
|
|
|
|
|
|
row5 = sapl.layout.to_row( |
|
|
|
|
|
[('secretario',6), |
|
|
|
|
|
('email',6)]) |
|
|
|
|
|
|
|
|
|
|
|
row6 = sapl.layout.to_row( |
|
|
|
|
|
[('finalidade', 12)]) |
|
|
|
|
|
|
|
|
|
|
|
row7 = sapl.layout.to_row( |
|
|
|
|
|
[('apelido_temp', 9), |
|
|
|
|
|
('data_instalacao_temp',3)]) |
|
|
|
|
|
|
|
|
|
|
|
row8 = sapl.layout.to_row( |
|
|
|
|
|
[('data_final_prevista_temp',4), |
|
|
|
|
|
('data_prorrogada_temp',4), |
|
|
|
|
|
('data_fim_comissao',4)]) |
|
|
|
|
|
|
|
|
|
|
|
self.helper = FormHelper() |
|
|
|
|
|
self.helper.layout = Layout( |
|
|
|
|
|
Fieldset( |
|
|
|
|
|
'', |
|
|
|
|
|
Fieldset( |
|
|
|
|
|
'Dados Básicos', |
|
|
|
|
|
row1, |
|
|
|
|
|
row2 |
|
|
|
|
|
), |
|
|
|
|
|
Fieldset( |
|
|
|
|
|
'Dados Complementares', |
|
|
|
|
|
row3, |
|
|
|
|
|
row4, |
|
|
|
|
|
row5, |
|
|
|
|
|
row6 |
|
|
|
|
|
), |
|
|
|
|
|
Fieldset( |
|
|
|
|
|
'Temporária', |
|
|
|
|
|
row7, |
|
|
|
|
|
row8 |
|
|
|
|
|
), |
|
|
|
|
|
ButtonHolder( |
|
|
|
|
|
Submit('submit', 'Salvar', |
|
|
|
|
|
css_class='button primary') |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
|
|
|
) |
|
|
|
|
|
super(CadastrarComissaoForm, self).__init__(*args, **kwargs) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CadastrarComissaoView(FormMixin, GenericView): |
|
|
|
|
|
|
|
|
|
|
|
template_name = "comissoes/cadastrar_comissao.html" |
|
|
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
|
form = CadastrarComissaoForm() |
|
|
|
|
|
|
|
|
|
|
|
return self.render_to_response({'form': form}) |
|
|
|
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
|
|
form = CadastrarComissaoForm(request.POST, request.FILES) |
|
|
|
|
|
|
|
|
|
|
|
if form.is_valid(): |
|
|
|
|
|
|
|
|
|
|
|
form.save() |
|
|
|
|
|
|
|
|
|
|
|
return self.form_valid(form) |
|
|
|
|
|
else: |
|
|
|
|
|
return self.render_to_response({'form': form}) |
|
|
|
|
|
|
|
|
|
|
|
def get_success_url(self): |
|
|
|
|
|
return reverse('comissao:cadastrar_comissao') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ComposicaoForm(forms.Form): |
|
|
class ComposicaoForm(forms.Form): |
|
|
periodo = forms.CharField() |
|
|
periodo = forms.CharField() |
|
|
|
|
|
|
|
|