Skip to content

Commit

Permalink
Changed how the template is rendered for proper safe strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Timmy O'Mahony committed Mar 13, 2014
1 parent 60eeac7 commit 54af255
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pagedown/templates/pagedown/widgets/default.html
@@ -1,9 +1,9 @@
<div class="wmd-wrapper" id="{{ id }}-wmd-wrapper">
<div class="wmd-panel">
<div id="{{ id }}_wmd_button_bar"></div>
<textarea{{ attrs }}>{{ body }}</textarea>
<div id="{{ id|safe }}_wmd_button_bar"></div>
<textarea{{ attrs|safe }}>{{ body }}</textarea>
</div>
{% if show_preview %}
<div id="{{ id }}_wmd_preview" class="wmd-panel wmd-preview"></div>
<div id="{{ id|safe }}_wmd_preview" class="wmd-panel wmd-preview"></div>
{% endif %}
</div>
4 changes: 2 additions & 2 deletions pagedown/widgets.py
Expand Up @@ -44,13 +44,13 @@ def render(self, name, value, attrs=None):
attrs['class'] = ""
attrs['class'] += " wmd-input"
final_attrs = self.build_attrs(attrs, name=name)
rendered_html = render_to_string(self.template, {
return render_to_string(self.template, {
'attrs': flatatt(final_attrs),
'body': conditional_escape(force_unicode(value)),
'id': final_attrs['id'],
'show_preview': self.show_preview,
})
return mark_safe(rendered_html)



class AdminPagedownWidget(PagedownWidget, admin_widgets.AdminTextareaWidget):
Expand Down

0 comments on commit 54af255

Please sign in to comment.