mirror of
https://github.com/django/django.git
synced 2025-07-06 10:49:17 +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:
parent
4927c2cf1e
commit
c0f3555eef
@ -114,6 +114,7 @@ def items_for_result(cl, result):
|
|||||||
# or a property.
|
# or a property.
|
||||||
try:
|
try:
|
||||||
attr = getattr(result, field_name)
|
attr = getattr(result, field_name)
|
||||||
|
allow_tags = getattr(attr, 'allow_tags', False)
|
||||||
if callable(attr):
|
if callable(attr):
|
||||||
attr = attr()
|
attr = attr()
|
||||||
result_repr = str(attr)
|
result_repr = str(attr)
|
||||||
@ -122,7 +123,7 @@ def items_for_result(cl, result):
|
|||||||
else:
|
else:
|
||||||
# Strip HTML tags in the resulting text, except if the
|
# Strip HTML tags in the resulting text, except if the
|
||||||
# function has an "allow_tags" attribute set to True.
|
# 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)
|
result_repr = escape(result_repr)
|
||||||
else:
|
else:
|
||||||
field_val = getattr(result, f.attname)
|
field_val = getattr(result, f.attname)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user