|
|
@ -194,8 +194,14 @@ class SessaoPlenariaForm(ModelForm): |
|
|
class RetiradaPautaForm(ModelForm): |
|
|
class RetiradaPautaForm(ModelForm): |
|
|
|
|
|
|
|
|
tipo_de_retirada = forms.ModelChoiceField(required=True, |
|
|
tipo_de_retirada = forms.ModelChoiceField(required=True, |
|
|
empty_label='------', |
|
|
empty_label='------------', |
|
|
queryset=TipoRetiradaPauta.objects.all()) |
|
|
queryset=TipoRetiradaPauta.objects.all()) |
|
|
|
|
|
expediente = forms.ModelChoiceField(required=False, |
|
|
|
|
|
label='Matéria do Expediente', |
|
|
|
|
|
queryset=ExpedienteMateria.objects.all()) |
|
|
|
|
|
ordem = forms.ModelChoiceField(required=False, |
|
|
|
|
|
label='Matéria da Ordem do Dia', |
|
|
|
|
|
queryset=OrdemDia.objects.all()) |
|
|
|
|
|
|
|
|
class Meta: |
|
|
class Meta: |
|
|
model = RetiradaPauta |
|
|
model = RetiradaPauta |
|
|
@ -203,16 +209,17 @@ class RetiradaPautaForm(ModelForm): |
|
|
'expediente', |
|
|
'expediente', |
|
|
'parlamentar', |
|
|
'parlamentar', |
|
|
'tipo_de_retirada', |
|
|
'tipo_de_retirada', |
|
|
'data'] |
|
|
'data', |
|
|
|
|
|
'observacao'] |
|
|
|
|
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
|
|
|
|
row1 = to_row[('tipo_de_retirada', 5), |
|
|
row1 = to_row([('tipo_de_retirada', 5), |
|
|
('parlamentar', 4), |
|
|
('parlamentar', 4), |
|
|
('data', 3)] |
|
|
('data', 3)]) |
|
|
row2 = to_row[('ordem', 6), |
|
|
row2 = to_row([('ordem', 6), |
|
|
('expediente', 6)] |
|
|
('expediente', 6)]) |
|
|
row3 = to_row[('observacao',12)] |
|
|
row3 = to_row([('observacao',12)]) |
|
|
|
|
|
|
|
|
self.helper = FormHelper() |
|
|
self.helper = FormHelper() |
|
|
self.helper.layout = SaplFormLayout( |
|
|
self.helper.layout = SaplFormLayout( |
|
|
@ -229,13 +236,23 @@ class RetiradaPautaForm(ModelForm): |
|
|
q).order_by('parlamentar__nome_parlamentar') |
|
|
q).order_by('parlamentar__nome_parlamentar') |
|
|
presentes = [p.parlamentar for p in presencas] |
|
|
presentes = [p.parlamentar for p in presencas] |
|
|
|
|
|
|
|
|
self.fields['materias_do_expediente'].choices = [ |
|
|
self.fields['expediente'].choices = [ |
|
|
(e.id, e.materia) for e in expedientes] |
|
|
("0", "------------")] + [(e.id, e.materia) for e in expedientes] |
|
|
self.fields['materias_da_ordem_do_dia'].choices = [ |
|
|
self.fields['ordem'].choices = [ |
|
|
(o.id, o.materia) for o in ordens] |
|
|
("0", "------------")] + [(o.id, o.materia) for o in ordens] |
|
|
self.fields['parlamentar'].choices = [ |
|
|
self.fields['parlamentar'].choices = [ |
|
|
("0", "------------")] + [(p.id, p) for p in presentes] |
|
|
("0", "------------")] + [(p.id, p) for p in presentes] |
|
|
|
|
|
|
|
|
|
|
|
def clean_data(self): |
|
|
|
|
|
cleaned_data = super(RetiradaPautaForm, self).clean() |
|
|
|
|
|
|
|
|
|
|
|
if not self.is_valid(): |
|
|
|
|
|
return self.cleaned_data |
|
|
|
|
|
|
|
|
|
|
|
sessao_plenaria = self.instance.sessao_plenaria |
|
|
|
|
|
|
|
|
|
|
|
return cleaned_data |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BancadaForm(ModelForm): |
|
|
class BancadaForm(ModelForm): |
|
|
|
|
|
|
|
|
|