app/soc/views/helper/templatetags/forms_helpers.py
changeset 1977 2dab2aac313d
parent 1964 96e45d34ee71
child 2077 fd2e83a297c7
equal deleted inserted replaced
1976:be994529deee 1977:2dab2aac313d
    29 from django import template
    29 from django import template
    30 from django.forms import forms as forms_in
    30 from django.forms import forms as forms_in
    31 from django.utils.encoding import force_unicode
    31 from django.utils.encoding import force_unicode
    32 from django.utils.html import escape
    32 from django.utils.html import escape
    33 
    33 
       
    34 from soc.logic import accounts
    34 from soc.logic import dicts
    35 from soc.logic import dicts
    35 from soc.logic.models import user as user_logic
    36 from soc.logic.models import user as user_logic
    36 from soc.views.helper import redirects
    37 from soc.views.helper import redirects
    37 from soc.views.helper import widgets
    38 from soc.views.helper import widgets
    38 
    39 
    44 def as_user(user):
    45 def as_user(user):
    45   """Prints a user as a hyperlinked link_id.
    46   """Prints a user as a hyperlinked link_id.
    46   """
    47   """
    47 
    48 
    48   return {'user': user}
    49   return {'user': user}
       
    50 
       
    51 
       
    52 @register.inclusion_tag('soc/templatetags/_as_email.html')
       
    53 def as_email(account):
       
    54   """Prints a user as a hyperlinked link_id.
       
    55   """
       
    56 
       
    57   denormalized = accounts.denormalizeAccount(account)
       
    58 
       
    59   return {'email': denormalized.email()}
    49 
    60 
    50 
    61 
    51 @register.inclusion_tag('soc/templatetags/_field_as_table_row.html')
    62 @register.inclusion_tag('soc/templatetags/_field_as_table_row.html')
    52 def field_as_table_row(field):
    63 def field_as_table_row(field):
    53   """Prints a newforms field as a table row.
    64   """Prints a newforms field as a table row.