title: Django admin custom javascript load order
body: <p>I am using jquery to add a few features onto some fields in the django admin, inlcuding my code by using something like the following:</p>
  
  <pre><code>class SomeAdmin(admin.ModelAdmin):
      class Media:
          js = (
                  "/static/js/lib/jquery-1.3.2.min.js",
                  "/static/js/admin/app/model.js"
              )
              ...
              ..
              .
  </code></pre>
  
  <p>It seems the admin includes all the normal js files:</p>
  
  <pre><code>&lt;script type="text/javascript" src="/media/js/core.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/media/js/admin/RelatedObjectLookups.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/media/js/getElementsBySelector.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/media/js/actions.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="/media/js/urlify.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Then any custom ones you specify as above, and <em>then</em> if you have specified any filter_horizontal/vertical fields, the following</p>
  
  <pre><code>&lt;script src="/media/js/SelectBox.js" type="text/javascript"/&gt;
  &lt;script src="/media/js/SelectFilter2.js" type="text/javascript"/&gt;
  </code></pre>
  
  <p>Which is a touch annoying as I would like to modify the resulting pair of select boxes.</p>
  
  <p>Is it possible to change the order of the  tags in the django admin? </p>
  
  <p>Failing that, is it possible in jquery to have some code run after <em>everything</em> else, I normally use $(document).ready(....), are there any events fired after this?</p>
  
  <p><strong>extra info</strong></p>
  
  <p>Quick update incase anyone wanted to the route alex vasi suggested spelt out, you can extend the admin templates by using a file like:</p>
  
  <pre><code>{% extends "admin/change_form.html" %}
  
  {% block extrahead %}{{ block.super }}
      &lt;script type="text/javascript" src="/static/js/admin/app/model/somefile.js"&gt;&lt;/script&gt;
  {% endblock %}
  </code></pre>
  
  <p>I placed this in /path/to/project/templates/admin/app/model/change_form.html, and its done.</p>