Change document content windows from a <div> to a <pre> to conserve space formatting
This commit is contained in:
@@ -88,12 +88,13 @@ class TextAreaDiv(forms.widgets.Widget):
|
|||||||
|
|
||||||
def render(self, name, value, attrs=None):
|
def render(self, name, value, attrs=None):
|
||||||
if value is None:
|
if value is None:
|
||||||
value = ''
|
value = u''
|
||||||
final_attrs = self.build_attrs(attrs, name=name)
|
|
||||||
result = mark_safe(u'<div%s>%s</div>' % (flatatt(final_attrs),
|
|
||||||
conditional_escape(force_unicode(value))))
|
|
||||||
|
|
||||||
return mark_safe(result.replace('\n', '<br>'))
|
flat_attrs = flatatt(self.build_attrs(attrs, name=name))
|
||||||
|
content = conditional_escape(force_unicode(value))
|
||||||
|
# Not needed for <pre> - .replace(u'\n', u'<br>').replace(u' ', u' ')
|
||||||
|
result = u'<pre%s>%s</pre>' % (flat_attrs, content)
|
||||||
|
return mark_safe(result)
|
||||||
|
|
||||||
|
|
||||||
# From: http://www.peterbe.com/plog/emailinput-html5-django
|
# From: http://www.peterbe.com/plog/emailinput-html5-django
|
||||||
|
|||||||
Reference in New Issue
Block a user