Explorar el Código

linebreaks in text fields

Juan Carlos hace 4 años
padre
commit
4ffe70c642

+ 3 - 0
marktplatz/forms.py

@@ -16,6 +16,7 @@ from crispy_forms.layout import Layout, Field, Fieldset, Div, Row, Column, HTML,
 from crispy_forms.bootstrap import InlineField
 from crispy_forms.helper import FormHelper
 from captcha.fields import CaptchaField
+from tinymce.widgets import TinyMCE
 from newsletter.forms import *
 
 from marktplatz.widgets import *
@@ -276,6 +277,8 @@ class ProductForm(forms.ModelForm, GeneralFields):
 
        self.fields['orga'].widget        = ListTextWidget(data_list=Product.ORGANIZATION,  name='orga_list')
        self.fields['rechtsform'].widget  = ListTextWidget(data_list=Product.RECHTSFORM,  name='rechtsform_list')
+       self.fields['beschreibung'].widget  = TinyMCE(attrs={'cols': 80, 'rows': 30})
+       self.fields['learning'].widget  = TinyMCE(attrs={'cols': 80, 'rows': 30})
        self.fields['edit'].widget  = HiddenInput()
        self.fields['public'].widget  = HiddenInput()
        #

+ 2 - 2
marktplatz/templates/marktplatz/product_detail.html

@@ -143,8 +143,8 @@
 					</div>
 
 
-					<p class="">{% if product.beschreibung %}<strong>{% field_name product.wohnprojekt 'beschreibung' %}</strong>:<br>{{ product.beschreibung | safe }}{% endif %}</p>
-					<p class="">{% if product.learning %}<strong>{% field_name product.wohnprojekt 'learning' %}</strong>:<br>{{ product.learning }}{% endif %}</p>
+					<p class="">{% if product.beschreibung %}<strong>{% field_name product.wohnprojekt 'beschreibung' %}</strong>:<br>{{ product.beschreibung | safe | linebreaks   }}{% endif %}</p>
+					<p class="">{% if product.learning %}<strong>{% field_name product.wohnprojekt 'learning' %}</strong>:<br>{{ product.learning | safe | linebreaks  }}{% endif %}</p>
 
 
 					<div class="">

+ 2 - 2
project_base/settings.py

@@ -237,8 +237,8 @@ INSTALLED_APPS = [
     'debug_toolbar',
     'fullurl',
     'django_user_agents',
-     'email_obfuscator',
-     'compressor',
+    'email_obfuscator',
+    'compressor',
 
     'project_base.apps.PostOfficeBase',
     'project_base.apps.project_base',