#5767: EmailField should render as a mailto anchor in admin list page
------------------------------+---------------------------------------------
Reporter: hax | Owner: nobody
Status: new | Component: Admin interface
Version: newforms-admin | Resolution:
Keywords: EmailField | Stage: Design decision needed
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 1
------------------------------+---------------------------------------------
Comment (by hax):
Oops :)
I'm pretty sure this is right (and for some reason, it won't let me attach
in a reply, or I'd upload it as a diff):
{{{
Index: django/contrib/admin/templatetags/admin_list.py
===================================================================
--- django/contrib/admin/templatetags/admin_list.py (revision 6525)
+++ django/contrib/admin/templatetags/admin_list.py (working copy)
@@ -177,6 +177,12 @@
result_repr = ('%%.%sf' % f.decimal_places) %
field_val
else:
result_repr = EMPTY_CHANGELIST_VALUE
+ # EmailFields are mailto links
+ elif isinstance(f, models.EmailField):
+ if field_val:
+ result_repr = '<a href="mailto:%s">%s</a>' %
(escape(field_val), escape(field_val))
+ else:
+ result_repr = ""
# Fields with choices are special: Use the representation
# of the choice.
elif f.choices:
}}}
--hax
--
Ticket URL: <http://code.djangoproject.com/ticket/5767#comment:4>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---