@register.filter
def profile_fields(user):
 fields = OrderedDict()
 try:
  profile = get_profile_for_user(user)
  user_fieldname = get_profile_user_fieldname()
  exclude = tuple(settings.ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS)
  for field in profile._meta.fields:
   if (field.name not in ((u'id', user_fieldname) + exclude)):
    value = getattr(profile, field.name)
    fields[field.verbose_name.title()] = value
 except ProfileNotConfigured:
  pass
 return list(fields.items())

@ register . filter def profile_fields ( user ) : fields = OrderedDict ( ) try : profile = get_profile_for_user ( user ) user_fieldname = get_profile_user_fieldname ( ) exclude = tuple ( settings . ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS ) for field in profile . _meta . fields : if ( field . name not in ( ( u'id' , user_fieldname ) + exclude ) ) : value = getattr ( profile , field . name ) fields [ field . verbose_name . title ( ) ] = value except ProfileNotConfigured : pass return list ( fields . items ( ) )
returns profile fields as a dict for the given user .