title: Python and Django. Remove all js from html
body: <p>I want to display user typed html (from WYSIWYG). </p>
  
  <p>But I have some problems with removing js from html.</p>
  
  <p>Here is my view:</p>
  
  <pre><code>def bad_view(request):
      # in real project we got it from user
      bad_html = '&lt;p onclick="alert(0)"&gt;:((&lt;/p&gt;&lt;script&gt;alert(0);&lt;/script&gt;'
      return render(request, 'template.html', {'bad_html': bad_html})
  </code></pre>
  
  <p>Here code in my template:</p>
  
  <pre><code>{{ bad_html|safe }}
  </code></pre>
  
  <p>bad_html should be like this <code>&lt;p onclick=""&gt;:((&lt;/p&gt;</code></p>
  
  <p>What is <strong>best</strong> way to remove ALL js from this html? </p>
  
  <p>For removing <code>&lt;script&gt;</code> I can use regex, but what about onclick handler(and other js handlers)?</p>
  
  <p>Thanks for your advices!</p>