On Fri, 2008-04-25 at 04:27 -0700, mbdtsmh wrote:
> Hi all - In the standard admin page for the latest svn release I'm
> having problems rendering html correctly in the table.
> 
> Some of my text fields contain html markup: <a href=http://
> www.google.com>link to google</link> for example.
> 
> However, when I render these fields (using the change_list.html admin
> template) i get &lt,  &gt for some of the brackets < & > in the output
> html.
> 
> If I change the change_list_results.html file so it uses the item|safe
> filter I still get the same problem:

If I understand what you're saying (that you actually want the HTML text
to be interpreted by the browser, rather than being displayed as
source), you need to take a different approach:

The output strings are escaped before they reach the template for the
admin (in templatetags/admin_list.py in items_for_results). If you want
the raw text to actually be treated as HTML, you need to use a method to
display the field (rather than just including the field in the
Admin.list_display list) and set the allow_tags attribute on the method.

See http://www.djangoproject.com/documentation/model-api/#list-display
for the details -- search for "allow_tags" in that section.

Regards,
Malcolm


-- 
Despite the cost of living, have you noticed how popular it remains? 
http://www.pointy-stick.com/blog/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to