From 4b9b4739ebf539332f745f406de6856770f32f1a Mon Sep 17 00:00:00 2001 From: Eduardo Edson Batista Cordeiro Alves Date: Mon, 27 Jun 2016 15:55:31 -0300 Subject: [PATCH] =?UTF-8?q?Pr=C3=A9-preenche=20campo=20casa=20do=20usu?= =?UTF-8?q?=C3=A1rio=20e=20torna=20readonly?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/apps/solicitacoes/forms.py | 9 +++++++-- sigi/apps/solicitacoes/views.py | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sigi/apps/solicitacoes/forms.py b/sigi/apps/solicitacoes/forms.py index 0511c47..a9fe305 100644 --- a/sigi/apps/solicitacoes/forms.py +++ b/sigi/apps/solicitacoes/forms.py @@ -42,8 +42,13 @@ class SolicitacaoForm(ModelForm): fields = [u'codigo', u'usuario', u'sistema', u'email_contato', u'telefone_contato', u'casa_legislativa', u'titulo', u'resumo'] - widgets = {u'codigo': forms.HiddenInput(), - u'usuario': forms.HiddenInput()} + widgets = { + u'codigo': forms.HiddenInput(), + u'usuario': forms.HiddenInput(), + u'casa_legislativa': forms.TextInput(attrs={'readonly':'readonly'}), + u'email_contato': forms.TextInput(attrs={'readonly':'readonly'}), + u'telefone_contato': forms.TextInput(attrs={'readonly':'readonly'}) + } @transaction.atomic def save(self, commit=False): diff --git a/sigi/apps/solicitacoes/views.py b/sigi/apps/solicitacoes/views.py index 59a95e4..ba8729a 100644 --- a/sigi/apps/solicitacoes/views.py +++ b/sigi/apps/solicitacoes/views.py @@ -26,6 +26,7 @@ class SolicitacaoCrud(LoginRequiredMixin, Crud): self.initial[u'codigo'] = random.randint(0, 65500) self.initial[u'email_contato'] = usuario.email self.initial[u'telefone_contato'] = usuario.primeiro_telefone + self.initial[u'casa_legislativa'] = usuario.casa_legislativa except Usuario.DoesNotExist: pass return self.initial.copy()