Skip to content
Browse files

Fixed #766 -- Custom methods in admin.list_display can now have an al…

…low_tags attribute, which doesn't strip tags in the methods' output. Thanks, plisk

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent cb222e4 commit 632b63ad76efafff2f602de9c5a4464faa37d51b @adrianholovaty adrianholovaty committed
Showing with 7 additions and 1 deletion.
  1. +7 −1 django/contrib/admin/views/
8 django/contrib/admin/views/
@@ -388,10 +388,16 @@ def change_list(request, app_label, module_name):
except meta.FieldDoesNotExist:
# For non-field list_display values, the value is a method
# name. Execute the method.
+ func = getattr(result, field_name)
- result_repr = strip_tags(str(getattr(result, field_name)()))
+ result_repr = str(func())
except ObjectDoesNotExist:
+ else:
+ # Strip HTML tags in the resulting text, except if the
+ # function has an "allow_tags" attribute set to True.
+ if not getattr(func, 'allow_tags', False):
+ result_repr = strip_tags(result_repr)
field_val = getattr(result, f.attname)
# Foreign-key fields are special: Use the repr of the

0 comments on commit 632b63a

Please sign in to comment.
Something went wrong with that request. Please try again.