# HG changeset patch # User Sverre Rabbelier # Date 1237640792 0 # Node ID 2dab2aac313d1c5a97d2835c07c516f805d29ca1 # Parent be994529deeed16536b0e1e86893795748a274b8 Added an as_email template tag Patch by: Sverre Rabbelier diff -r be994529deee -r 2dab2aac313d app/soc/templates/soc/templatetags/_as_email.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/soc/templates/soc/templatetags/_as_email.html Sat Mar 21 13:06:32 2009 +0000 @@ -0,0 +1,15 @@ +{% 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 %} + +{{ email }} diff -r be994529deee -r 2dab2aac313d app/soc/views/helper/templatetags/forms_helpers.py --- a/app/soc/views/helper/templatetags/forms_helpers.py Sat Mar 21 10:40:20 2009 +0000 +++ b/app/soc/views/helper/templatetags/forms_helpers.py Sat Mar 21 13:06:32 2009 +0000 @@ -31,6 +31,7 @@ from django.utils.encoding import force_unicode from django.utils.html import escape +from soc.logic import accounts from soc.logic import dicts from soc.logic.models import user as user_logic from soc.views.helper import redirects @@ -48,6 +49,16 @@ return {'user': user} +@register.inclusion_tag('soc/templatetags/_as_email.html') +def as_email(account): + """Prints a user as a hyperlinked link_id. + """ + + denormalized = accounts.denormalizeAccount(account) + + return {'email': denormalized.email()} + + @register.inclusion_tag('soc/templatetags/_field_as_table_row.html') def field_as_table_row(field): """Prints a newforms field as a table row.