title: Django template onclick inline html javascript alternative
body: <p>I read that using <code>onclick</code> is deprecated and bad practice. </p>
  
  <p>I have this <code>do_something</code> function that will proccess the data inside of <code>onclick</code>. How I can convert this to javascript:</p>
  
  <pre><code>{% for user in all_user %}
  &lt;tr&gt;
      &lt;td&gt;{{ user.code }}&lt;/td&gt;
      &lt;td&gt;
          &lt;button type="button" onclick="do_something('{{ user.name }}', '{{ user.age }}', 1, '{{ user.desc }}');"&gt;small&lt;/h6&gt;&lt;/button&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  {% endfor %}
  </code></pre>