From 65662fd60d8b84ceaed3b7b44d9c9c597115ff17 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Fri, 11 Mar 2016 15:30:40 -0300 Subject: [PATCH 1/2] Fix #240 --- base/forms.py | 1 + parlamentares/forms.py | 3 ++- parlamentares/views.py | 9 ++------- static/js/app.js | 5 ++++- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/base/forms.py b/base/forms.py index 0c80ec947..070465105 100644 --- a/base/forms.py +++ b/base/forms.py @@ -34,6 +34,7 @@ class CasaLegislativaTabelaAuxForm(ModelForm): 'cep': forms.TextInput(attrs={'class': 'cep'}), 'telefone': forms.TextInput(attrs={'class': 'telefone'}), 'fax': forms.TextInput(attrs={'class': 'telefone'}), + 'informacao_geral': forms.Textarea(attrs={'id': 'casa-informacoes'}) } def __init__(self, *args, **kwargs): diff --git a/parlamentares/forms.py b/parlamentares/forms.py index 0f016668c..9faa5df27 100644 --- a/parlamentares/forms.py +++ b/parlamentares/forms.py @@ -68,7 +68,8 @@ class ParlamentaresForm (ModelForm): 'telefone_residencia': forms.TextInput(attrs={ 'class': 'telefone'}), 'fax_residencia': forms.TextInput(attrs={'class': 'telefone'}), - 'fotografia': forms.FileInput + 'fotografia': forms.FileInput, + 'biografia': forms.Textarea(attrs={'id': 'biografia-parlamentar'}) } def __init__(self, *args, **kwargs): diff --git a/parlamentares/views.py b/parlamentares/views.py index f90292d78..a430ba698 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -3,7 +3,6 @@ from re import sub from django.contrib import messages from django.core.urlresolvers import reverse -from django.utils.html import strip_tags from django.utils.translation import ugettext_lazy as _ from django.views.generic.edit import FormMixin from vanilla import GenericView @@ -129,9 +128,7 @@ class ParlamentaresCadastroView(FormMixin, GenericView): parlamentar = form.save(commit=False) if 'fotografia' in request.FILES: parlamentar.fotografia = request.FILES['fotografia'] - parlamentar.biografia = sub(' ', - ' ', - strip_tags(form.data['biografia'])) + parlamentar.biografia = form.data['biografia'] parlamentar.save() mandato = Mandato() @@ -167,9 +164,7 @@ class ParlamentaresEditarView(FormMixin, GenericView): parlamentar = form.save(commit=False) if 'fotografia' in request.FILES: parlamentar.fotografia = request.FILES['fotografia'] - parlamentar.biografia = sub(' ', - ' ', - strip_tags(form.data['biografia'])) + parlamentar.biografia = form.data['biografia'] parlamentar.save() elif 'excluir' in request.POST: Mandato.objects.get(parlamentar=parlamentar).delete() diff --git a/static/js/app.js b/static/js/app.js index 87d7b099f..778dfe844 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,5 +1,8 @@ -tinymce.init({selector:'textarea'}); +tinymce.init({ + mode : "exact", + elements : "biografia-parlamentar,casa-informacoes" + }); function refreshDatePicker() { $.datepicker.setDefaults($.datepicker.regional['pt-BR']); From e6ec02e885078a2529bd5ee9eef6566bf5e26272 Mon Sep 17 00:00:00 2001 From: Edward Ribeiro Date: Fri, 11 Mar 2016 15:33:30 -0300 Subject: [PATCH 2/2] Fix QA para 240 --- base/forms.py | 3 ++- parlamentares/views.py | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base/forms.py b/base/forms.py index 070465105..50161fb8c 100644 --- a/base/forms.py +++ b/base/forms.py @@ -34,7 +34,8 @@ class CasaLegislativaTabelaAuxForm(ModelForm): 'cep': forms.TextInput(attrs={'class': 'cep'}), 'telefone': forms.TextInput(attrs={'class': 'telefone'}), 'fax': forms.TextInput(attrs={'class': 'telefone'}), - 'informacao_geral': forms.Textarea(attrs={'id': 'casa-informacoes'}) + 'informacao_geral': forms.Textarea( + attrs={'id': 'casa-informacoes'}) } def __init__(self, *args, **kwargs): diff --git a/parlamentares/views.py b/parlamentares/views.py index a430ba698..9a0ad9662 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -1,5 +1,4 @@ import os -from re import sub from django.contrib import messages from django.core.urlresolvers import reverse