From f5d43d653decb4b793b8ed409014b9d45a4b57d4 Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Wed, 4 May 2016 10:29:39 -0300 Subject: [PATCH] =?UTF-8?q?Disabilita=20localiza=C3=A7=C3=A3o=20atual?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- materia/forms.py | 7 +++++++ materia/views.py | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) 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):