Added a readonly_multiline_field_as_table_row tag
authorSverre Rabbelier <srabbelier@gmail.com>
Sat, 13 Dec 2008 12:48:49 +0000
changeset 728 602c2b2f4d8b
parent 727 ddf44af087a0
child 729 7fe218e3d359
Added a readonly_multiline_field_as_table_row tag This is useful when a field is allowed to include newlines. Patch by: Sverre Rabbelier
app/soc/templates/soc/templatetags/_readonly_multiline_field_as_table_row.html
app/soc/views/helper/templatetags/forms_helpers.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/templatetags/_readonly_multiline_field_as_table_row.html	Sat Dec 13 12:48:49 2008 +0000
@@ -0,0 +1,21 @@
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+<tr title="{{ field.help_text }}">
+ <td class="formfieldlabel">
+	{{ field_label }}:
+ </td>
+ <td class="formfieldvalue">
+	{{ field_value|linebreaks }}
+ </td>
+</tr>
--- a/app/soc/views/helper/templatetags/forms_helpers.py	Sat Dec 13 11:02:08 2008 +0000
+++ b/app/soc/views/helper/templatetags/forms_helpers.py	Sat Dec 13 12:48:49 2008 +0000
@@ -90,3 +90,10 @@
   return {'field_label': field_label,
           'field_value': field_value}
 
+
+@register.inclusion_tag('soc/templatetags/_readonly_multiline_field_as_table_row.html')
+def readonly_multiline_field_as_table_row(field_label, field_value):
+  """See readonly_field_as_table_row, but with a different template tag
+  """
+  return {'field_label': field_label,
+          'field_value': field_value}