title: sweetalert not working on django template
body: <p>I started with the following code to send the ID to a method to delete an object of model.But the first ID is always sent.</p>
  <p>this is my HTML and JavaScript code:</p>
  <pre><code>{% for yad in yads %}
    &lt;form action=&quot;{% url 'del-yadd' %}&quot; method=&quot;post&quot; id=&quot;myform&quot;&gt;
        {% csrf_token %}
        &lt;button type=&quot;button&quot; name=&quot;yidd&quot; value=&quot;{{yad.id}}&quot; id=&quot;btndelme&quot;  class=&quot; btn btn-danger&quot; onclick=&quot;
     swal({
            title: 'warning!',
            text: 'do you want to delete?',
            type: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            cancelButtonText:'no',
            confirmButtonText: 'yes'
           },
           function(isConfirm) {
            if (isConfirm) {
               document.querySelector('#myform').submit();
              }});   
  &quot;&gt;delete&lt;/button&gt; 
      
    &lt;/form&gt;
  {% endfor %}
  </code></pre>
  <p>and this is my Django view code:
  def delete_yadd(request):
  id=request.POST['yidd']
  yad=Yadd.objects.filter(id=id).delete()
  return redirect('home')</p>