1
0
mirror of https://github.com/django/django.git synced 2025-07-05 02:09:13 +00:00

magic-removal: Fixed 'allow_tags' behavior for model methods in admin change lists.

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2544 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Joseph Kocherhans 2006-03-21 18:31:31 +00:00
parent 4927c2cf1e
commit c0f3555eef

View File

@ -114,6 +114,7 @@ def items_for_result(cl, result):
# or a property.
try:
attr = getattr(result, field_name)
allow_tags = getattr(attr, 'allow_tags', False)
if callable(attr):
attr = attr()
result_repr = str(attr)
@ -122,7 +123,7 @@ def items_for_result(cl, result):
else:
# Strip HTML tags in the resulting text, except if the
# function has an "allow_tags" attribute set to True.
if not getattr(attr, 'allow_tags', False):
if not allow_tags:
result_repr = escape(result_repr)
else:
field_val = getattr(result, f.attname)