Allow tags in media section
@@ -583,17 +583,16 @@ class Media(models.Model):
def image(self):
if self.extension in ['png', 'jpg', 'jpeg']:
- return u'<img width="60" src="%s" />' % os.path.join(
- settings.PAGES_MEDIA_URL, self.url.name)
+ return mark_safe('<img width="60" src="%s" />' % os.path.join(
+ settings.PAGES_MEDIA_URL, self.url.name))
if self.extension == 'pdf':
- return u'<i class="fa fa-file-pdf-o" aria-hidden="true"></i>'
+ return mark_safe('<i class="fa fa-file-pdf-o" aria-hidden="true"></i>')
if self.extension in ['doc', 'docx']:
- return u'<i class="fa fa-file-word-o" aria-hidden="true"></i>'
+ return mark_safe('<i class="fa fa-file-word-o" aria-hidden="true"></i>')
if self.extension in ['zip', 'gzip', 'rar']:
- return u'<i class="fa fa-file-archive-o" aria-hidden="true"></i> '
- return u'<i class="fa fa-file-o" aria-hidden="true"></i>'
+ return mark_safe('<i class="fa fa-file-archive-o" aria-hidden="true"></i>')
+ return mark_safe('<i class="fa fa-file-o" aria-hidden="true"></i>')
image.short_description = _('Thumbnail')
- image.allow_tags = True
class Meta:
verbose_name_plural = _('Medias')
