# HG changeset patch # User Sverre Rabbelier # Date 1236897004 0 # Node ID 7a9b69f36111a7ad21cea712c977173b7f9b67a1 # Parent 0c4fd663704b523fafdbb5335c96f524f716df08 Always convert newlines to linebreaks Patch by: Sverre Rabbelier diff -r 0c4fd663704b -r 7a9b69f36111 app/soc/templates/soc/templatetags/_readonly_field_as_table_row.html --- a/app/soc/templates/soc/templatetags/_readonly_field_as_table_row.html Thu Mar 12 22:29:14 2009 +0000 +++ b/app/soc/templates/soc/templatetags/_readonly_field_as_table_row.html Thu Mar 12 22:30:04 2009 +0000 @@ -19,7 +19,7 @@ {% block field_value_column %} - {{ field_value }} + {{ field_value|linebreaksbr }} {% endblock %} diff -r 0c4fd663704b -r 7a9b69f36111 app/soc/templates/soc/templatetags/_readonly_field_as_twoline_table_row.html --- a/app/soc/templates/soc/templatetags/_readonly_field_as_twoline_table_row.html Thu Mar 12 22:29:14 2009 +0000 +++ b/app/soc/templates/soc/templatetags/_readonly_field_as_twoline_table_row.html Thu Mar 12 22:30:04 2009 +0000 @@ -21,7 +21,7 @@ {% block field_value_column %} - {{ field_value }} + {{ field_value|linebreaksbr }} {% endblock %} diff -r 0c4fd663704b -r 7a9b69f36111 app/soc/views/helper/templatetags/forms_helpers.py --- a/app/soc/views/helper/templatetags/forms_helpers.py Thu Mar 12 22:29:14 2009 +0000 +++ b/app/soc/views/helper/templatetags/forms_helpers.py Thu Mar 12 22:30:04 2009 +0000 @@ -70,7 +70,7 @@ @register.inclusion_tag('soc/templatetags/_readonly_field_as_table_row.html') -def readonly_field_as_table_row(field_label, field_value): +def readonly_field_as_table_row(label, value): """Prints a field value and it's verbose name as a table row. This function actually does very little, simply passing the @@ -98,17 +98,23 @@ { 'field_label': field_label', 'field_value': field_value'} """ - return {'field_label': field_label, - 'field_value': field_value} + + value = value.strip() if isinstance(value, basestring) else value + + return {'field_label': label, + 'field_value': value} @register.inclusion_tag( 'soc/templatetags/_readonly_field_as_twoline_table_row.html') -def readonly_field_as_twoline_table_row(field_label, field_value): +def readonly_field_as_twoline_table_row(label, value): """See readonly_field_as_table_row(). """ - return {'field_label': field_label, - 'field_value': field_value} + + value = value.strip() if isinstance(value, basestring) else value + + return {'field_label': label, + 'field_value': value} @register.inclusion_tag(