--- a/app/soc/views/helpers/templatetags/forms_helpers.py Wed Aug 20 21:59:00 2008 +0000
+++ b/app/soc/views/helpers/templatetags/forms_helpers.py Fri Aug 22 13:44:50 2008 +0000
@@ -19,6 +19,7 @@
__authors__ = [
'"Todd Larsen" <tlarsen@google.com>',
+ '"Pawel Solyga" <pawel.solyga@gmail.com>',
]
@@ -53,3 +54,37 @@
{ 'field': field }
"""
return {'field': field}
+
+
+@register.inclusion_tag('soc/templatetags/_readonly_field_as_table_row.html')
+def readonly_field_as_table_row(field_label, field_value):
+ """Prints a field value and it's verbose name as a table row.
+
+ This function actually does very little, simply passing the
+ supplied field_label and field_value in a simple context used by the
+ _readonly_field_as_table_row.html template (which is actually
+ doing all of the work).
+
+ See soc/templates/soc/templatetags/_readonly_field_as_table_row.html for the CSS
+ styles used by this template tag.
+
+ Usage:
+ {% load forms_helpers %}
+ ...
+ <table>
+ {% readonly_field_as_table_row field_label field_value %}
+ ...
+ </table>
+
+ Args:
+ field_label: label of the field to render
+ field_value: value of the field to render
+
+ Returns:
+ a simple context containing the supplied newforms field instance:
+ { 'field_label': field_label',
+ 'field_value': field_value'}
+ """
+ return {'field_label': field_label,
+ 'field_value': field_value}
+