diff --git a/base/forms.py b/base/forms.py index 0c80ec947..50161fb8c 100644 --- a/base/forms.py +++ b/base/forms.py @@ -34,6 +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'}) } 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..9a0ad9662 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -1,9 +1,7 @@ import os -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 +127,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 +163,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 c07bf4b2e..2ae9c1c57 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']);