title: using inline javascript inside a python loop
body: <p>I have a list of entries.  Insider the list of entries I have a link to individual entries. I have an update form that updates one field.</p>
  <p>I want to open the update form inside a new window.  The user then submits the form is directed to a success page which currently has a timed close.</p>
  <p>The issue I am encountering is with the inline JavaScript which opens the form in a new window.  When I attempt to assign the kwarg on the URL it the JavaScript does not change with each entry in the list.</p>
  <p>I have limited JavaScript, and jQuery knowledge.</p>
  <p>I just want the JavaScript to open a new window for each update form.</p>
  <p>I have included the template below.</p>
  <pre><code>                &lt;thead&gt;
                    &lt;tr&gt;
                      &lt;th&gt;Script No.&lt;/th&gt;
                      &lt;th&gt;Entered on&lt;/th&gt;
                      &lt;th&gt;Patient&lt;/th&gt;
                      &lt;th&gt;Email&lt;/th&gt;
                      &lt;th&gt;Product&lt;/th&gt;
                      &lt;th&gt;Form&lt;/th&gt;
                      &lt;th&gt;Units&lt;/th&gt;
                      &lt;th&gt;Dispensing Price&lt;/th&gt;
                      &lt;th&gt;Status&lt;/th&gt;
                      &lt;th&gt;Dispatch Date&lt;/th&gt;
                      &lt;th&gt;Entered by&lt;/th&gt;
                      &lt;th&gt;&lt;/th&gt;
                    &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                   {% for script in scripts %}
                   &lt;tr&gt;
                    &lt;td&gt;{{script.pk}}&lt;/td&gt;
                    &lt;td&gt;{{script.entered_on}}&lt;/td&gt;
                    &lt;td&gt;{{script.patient}}&lt;/td&gt;
                    &lt;td&gt;{{script.patient.email}}&lt;/td&gt;
                    &lt;td&gt;{{script.product}}&lt;/td&gt;
                    &lt;td&gt;{{script.product.form.description}}&lt;/td&gt;
                    &lt;td&gt;{{script.quantity}}&lt;/td&gt;
                    &lt;td&gt;$&amp;nbsp;{{ script.dispensing_price }}&lt;/td&gt;
                    {% if script.dispatch_date is not none %}
                    &lt;td&gt;{{script.get_script_status_display}}&lt;/td&gt;
                    {% else %}
                    &lt;td&gt;&lt;a href = &quot;{% url &quot;script:script_update_status&quot; script.pk %}&quot;&gt;{{script.get_script_status_display}}&lt;/a&gt;&lt;/td&gt;
                    {% endif %}
                    &lt;td&gt;&lt;a href =&quot;#&quot; onclick=&quot;updateStatus()&quot; style=&quot;float:right;&quot;&gt;
                      &lt;script&gt;var url = &quot;{% url &quot;script:script_update_status&quot; script.pk %}&quot;; 
                      function updateStatus() {var myWindow = window.open(url, &quot;_blank&quot;, &quot;toolbar=yes,scrollbars=yes,resizable=yes,top=500,left=500,width=400,height=250&quot;);}
                    &lt;/script&gt;&lt;/td&gt;
                    {% if script.dispatch_date is none %}
                    &lt;td&gt;Not Sent&lt;/td&gt;
                    {% else %}
                    &lt;td&gt;{{script.dispatch_date}}&lt;/td&gt;
                    {% endif %}
                    &lt;td&gt;{{script.created_by.first_name}}&amp;nbsp;{{script.created_by.last_name}}&lt;/td&gt;
                    &lt;td&gt;&lt;small&gt;&lt;a href = &quot;{% url 'script:script_detail' script.pk %}&quot;&gt;View&lt;/a&gt;&amp;nbsp;|&amp;nbsp; &lt;a href=&quot;{% url &quot;script:script_update&quot; script.pk %}&quot;&gt;Edit&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;{% url 'label:product_label' script.pk %}&quot;&gt;Lab Label&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;{% url 'label:dispense_label' script.pk %}&quot;&gt;Dispense Label
                    &lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;{% url 'label:shipping_label' script.pk %}&quot;&gt;Shipping Label&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;{% url &quot;label:receipt&quot; script.pk %}&quot; &gt;Health Fund Receipt&lt;/a&gt;&amp;nbsp;|&amp;nbsp;&lt;a href=&quot;{% url &quot;label:repeat&quot; script.pk %}&quot;&gt;Repeat&lt;/a&gt;&lt;/small&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  {% endfor %}
                &lt;/tbody&gt;
              &lt;/table&gt; ```
  Kind Regards
  
  AC
  </code></pre>