diff --git a/materia/forms.py b/materia/forms.py index 186c6ba09..ff932b4ee 100644 --- a/materia/forms.py +++ b/materia/forms.py @@ -176,6 +176,13 @@ class RelatoriaForm(ModelForm): return cleaned_data + class Meta: + model = Relatoria + model = Relatoria + fields = ['data_designacao_relator', 'comissao', 'parlamentar', + 'data_destituicao_relator', 'tipo_fim_relatoria'] + widgets = {'comissao': forms.Select(attrs={'disabled': 'disabled'})} + class TramitacaoForm(ModelForm): diff --git a/materia/views.py b/materia/views.py index 87e62e0e8..4dd09b160 100644 --- a/materia/views.py +++ b/materia/views.py @@ -57,7 +57,21 @@ ProposicaoCrud = Crud.build(Proposicao, '') StatusTramitacaoCrud = Crud.build(StatusTramitacao, 'status_tramitacao') UnidadeTramitacaoCrud = Crud.build(UnidadeTramitacao, 'unidade_tramitacao') -RelatoriaCrud = MasterDetailCrud.build(Relatoria, 'materia', '') + +class RelatoriaCrud(MasterDetailCrud): + model = Relatoria + parent_field = 'materia' + help_path = '' + + class CreateView(MasterDetailCrud.CreateView): + form_class = RelatoriaForm + + def get_initial(self): + self.initial['comissao'] = 8 + return self.initial + + class UpdateView(MasterDetailCrud.UpdateView): + form_class = RelatoriaForm class RelatoriaCrud(MasterDetailCrud):