__str__ must return str so can not return safe str
morever, format_html is recommanded by the doc for that usage.
This commit is contained in:
parent
78b2967e19
commit
1e293bd727
2 changed files with 3 additions and 6 deletions
|
@ -34,7 +34,7 @@
|
|||
<div class="panel-heading">
|
||||
<span class="badge"><span class="glyphicon glyphicon-{{ event.glyphicon }}"></span></span>
|
||||
 
|
||||
<a href="{% same_author event.author %}"><b>{{ event.author}}</b></a> {{ event }} {{ event.date|naturaltime }}
|
||||
<a href="{% same_author event.author %}"><b>{{ event.author}}</b></a> {{ event|safe }} {{ event.date|naturaltime }}
|
||||
{% if event.code == event.DESCRIBE %}
|
||||
<div class="pull-right">
|
||||
{% if perm.delete_issue %}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django.db import models
|
||||
from django.core.validators import RegexValidator
|
||||
from django.utils.safestring import mark_safe
|
||||
from django.utils.html import escape
|
||||
from django.utils.html import escape, format_html
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django import VERSION
|
||||
|
||||
|
@ -359,10 +359,7 @@ class Event(models.Model):
|
|||
else:
|
||||
return None
|
||||
|
||||
# Escape args
|
||||
safe_args = {k: escape(v) for k, v in args.items()}
|
||||
|
||||
return mark_safe(description.format(**safe_args))
|
||||
return format_html(description, **args)
|
||||
|
||||
|
||||
if VERSION < (1, 7):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue