app/soc/views/helper/templatetags/forms_helpers.py
changeset 1341 1b4b4a9ac17b
parent 1308 35b75ffcbb37
child 1360 f62c462037b6
--- a/app/soc/views/helper/templatetags/forms_helpers.py	Sun Feb 15 14:55:53 2009 +0000
+++ b/app/soc/views/helper/templatetags/forms_helpers.py	Sun Feb 15 14:56:30 2009 +0000
@@ -116,6 +116,21 @@
           'field_value': field_value}
 
 
+@register.inclusion_tag('soc/templatetags/_as_readonly_table.html',
+                        takes_context=True)
+def as_readonly_table(context, form):
+  """Outputs a form as a properly formatted html table.
+
+  Args:
+    form: the form that should be converted to a table
+  """
+
+  # create the bound fields
+  fields = [forms_in.BoundField(form, field, name) for name, field in
+            form.fields.items() if field]
+
+  return {'fields': fields}
+
 @register.inclusion_tag('soc/templatetags/_as_table.html', takes_context=True)
 def as_table(context, form):
   """Outputs a form as a properly formatted html table.