Avoid verbose_name HTML escaping in admin

53 views
Skip to first unread message

FraMazz

unread,
Apr 13, 2012, 5:15:46 AM4/13/12
to django...@googlegroups.com
Is it possible to avoid HTML escaping in admin?
I have defined a model with verbose_name for several fields.
In verbose_name I need HTML code to highlight part of the string e.g.
d1 = models.CharField(max_length=1, blank=False, default='0',  verbose_name="Hi <b>all</b>!'').
In admin the text gets escaped resulting in the whole string being shown (Hi <b>all</b>!) instead of Hi all!
I also tried verbose_name=mark_safe("Hi <b>all</b>!'') to no avail

Suggestions?
Thanks
Francesca

Andre Terra

unread,
Apr 13, 2012, 8:33:04 AM4/13/12
to django...@googlegroups.com

I'm only guessing, but I think the escaping is being done at rendering time by the template itself. Take a look at the default admin templates and check the docs for an explanation on how to override them with your own.

Protip: do not edit the original files!

Cheers,
AT

-- Sent from my phone, please excuse any typos. --

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/LYnO1AIlc_EJ.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Reply all
Reply to author
Forward
0 new messages