From 2c61c490cbb32200c127e970d4148e4a68e14fd9 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Wed, 29 Jun 2016 20:10:36 -0300 Subject: [PATCH] Adiciona detalhes Autorizacao para Proposicoes --- sapl/materia/forms.py | 3 ++- sapl/materia/views.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index af5810215..867eba3ac 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -101,7 +101,8 @@ class ProposicaoForm(ModelForm): class Meta: model = Proposicao - fields = ['tipo', 'data_envio', 'descricao', 'texto_original'] + fields = ['tipo', 'data_envio', 'descricao', 'texto_original', 'autor'] + widgets = {'autor': forms.HiddenInput()} class AcompanhamentoMateriaForm(ModelForm): diff --git a/sapl/materia/views.py b/sapl/materia/views.py index 519b45bb7..7bf713bc7 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -219,6 +219,10 @@ class ProposicaoCrud(Crud): def layout_key(self): return 'ProposicaoCreate' + def get_initial(self): + autor_id = Autor.objects.get(user=self.request.user.id) + return {'autor': autor_id} + class UpdateView(PermissionRequiredMixin, CrudUpdateView): form_class = ProposicaoForm permission_required = permissoes_autor()