# HG changeset patch # User Sverre Rabbelier # Date 1235952179 0 # Node ID 354e685d57fa038e10407a7990a703a688bc3289 # Parent 7a61eff82b9d1516b57f7599fdabdd84f8ece744 Added a _readonly_safe_field_as_table_row template tag Should only be used with fields that have been cleaned through feedparser or similar. Patch by: Sverre Rabbelier diff -r 7a61eff82b9d -r 354e685d57fa app/soc/templates/soc/templatetags/_readonly_safe_field_as_table_row.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/templatetags/_readonly_safe_field_as_table_row.html Mon Mar 02 00:02:59 2009 +0000 @@ -0,0 +1,18 @@ +{% extends "soc/templatetags/_readonly_field_as_table_row.html" %} +{% 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 %} + +{% block field_value_column %} +{{ field_value|safe }} +{% endblock %} diff -r 7a61eff82b9d -r 354e685d57fa app/soc/templates/soc/templatetags/_readonly_safe_field_as_twoline_table_row.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/templatetags/_readonly_safe_field_as_twoline_table_row.html Mon Mar 02 00:02:59 2009 +0000 @@ -0,0 +1,18 @@ +{% extends "soc/templatetags/_readonly_field_as_twoline_table_row.html" %} +{% 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 %} + +{% block field_value_column %} +{{ field_value|safe }} +{% endblock %} diff -r 7a61eff82b9d -r 354e685d57fa app/soc/templates/soc/templatetags/_readonly_url_field_as_twoline_table_row.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/templatetags/_readonly_url_field_as_twoline_table_row.html Mon Mar 02 00:02:59 2009 +0000 @@ -0,0 +1,18 @@ +{% extends "soc/templatetags/_readonly_field_as_twoline_table_row.html" %} +{% 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 %} + +{% block field_value_column %} +{{ field_value|urlize }} +{% endblock %} diff -r 7a61eff82b9d -r 354e685d57fa app/soc/views/helper/templatetags/forms_helpers.py --- a/app/soc/views/helper/templatetags/forms_helpers.py Mon Mar 02 00:02:11 2009 +0000 +++ b/app/soc/views/helper/templatetags/forms_helpers.py Mon Mar 02 00:02:59 2009 +0000 @@ -128,6 +128,23 @@ 'field_value': field_value} +@register.inclusion_tag('soc/templatetags/_readonly_safe_field_as_table_row.html') +def readonly_safe_field_as_table_row(field_label, field_value): + """See readonly_field_as_table_row(). + """ + return {'field_label': field_label, + 'field_value': field_value} + + +@register.inclusion_tag( + 'soc/templatetags/_readonly_safe_field_as_twoline_table_row.html') +def readonly_safe_field_as_twoline_table_row(field_label, field_value): + """See readonly_field_as_table_row(). + """ + return {'field_label': field_label, + 'field_value': field_value} + + @register.inclusion_tag('soc/templatetags/_as_readonly_table.html', takes_context=True) def as_readonly_table(context, form):