diff --git a/materia/forms.py b/materia/forms.py index 11c786949..624c48f9d 100644 --- a/materia/forms.py +++ b/materia/forms.py @@ -155,6 +155,12 @@ class RelatoriaForm(ModelForm): return cleaned_data + class Meta: + 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 cfd237477..5ff808576 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):