title: jQuery not loading in Django admin homepage/dashboard, login and logout pages
body: <p>I need to load a <code>js</code> file throught all django admin pages. Hence I copied the <code>base.html</code> file located in <code>django/contrib/admin/templates/admin/</code> and added it to my templates folder under <code>templates/admin/base.html</code>. Added the <code>js</code> file under <code>app_static/admin/js/</code> (location to my static files).</p>
  
  <p>Next, I included the <code>&lt;script&gt;</code> tags inside the <code>base.html</code> under the <code>{% block javascripts %}</code> tags.
  When I open the <code>change_list</code> and <code>change_form</code> pages, the <code>js</code> fires correctly. It does not fire in the homepage/dashboard, login and logout pages. Returns an error stating <code>Uncaught ReferenceError: django is not defined</code>. An error usually thrown when jQuery has not been initialized.</p>
  
  <p><em>session_expiry.js</em></p>
  
  <pre><code>(function($){
  
      console.log('js has been called');
  
  })(django.jQuery);
  </code></pre>
  
  <p><em>base.html</em></p>
  
  <pre><code>{% load i18n static %}&lt;!DOCTYPE html&gt;
  {% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
  &lt;html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}&gt;
  
      &lt;head&gt;
          &lt;title&gt;{% block title %}{% endblock %}&lt;/title&gt;
          &lt;link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}"&gt;
          {% block extrastyle %}{% endblock %}
          {% if LANGUAGE_BIDI %}&lt;link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}"&gt;{% endif %}
          {% block extrahead %}{% endblock %}
          {% block responsive %}
          &lt;meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"&gt;
          &lt;link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive.css" %}"&gt;
          {% if LANGUAGE_BIDI %}&lt;link rel="stylesheet" type="text/css" href="{% static "admin/css/responsive_rtl.css" %}"&gt;{% endif %}
          {% endblock %}
  
          {% block javascripts %}
              &lt;script type="text/javascript" src="{% static "admin/js/session_expiry.js" %}"&gt;&lt;/script&gt;
          {% endblock %}
  
          {% block blockbots %}&lt;meta name="robots" content="NONE,NOARCHIVE"&gt;{% endblock %}
      &lt;/head&gt;
      {% load i18n %}
  
      &lt;body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}" data-admin-utc-offset="{% now "Z" %}"&gt;
          &lt;!-- Container --&gt;
          &lt;div id="container"&gt;
              {% if not is_popup %}
              &lt;!-- Header --&gt;
              &lt;div id="header"&gt;
                  &lt;div id="branding"&gt;{% block branding %}{% endblock %}&lt;/div&gt;
                  {% block usertools %}
                      {% if has_permission %}
                          &lt;div id="user-tools"&gt;
                              {% block welcome-msg %}
                                  {% trans 'Welcome,' %}
                                  &lt;strong&gt;{% firstof user.get_short_name user.get_username %}&lt;/strong&gt;.
                              {% endblock %}
                              {% block userlinks %}
                                  {% if site_url %}
                                      &lt;a href="{{ site_url }}"&gt;{% trans 'View site' %}&lt;/a&gt; /
                                  {% endif %}
                                  {% if user.is_active and user.is_staff %}
                                      {% url 'django-admindocs-docroot' as docsroot %}
                                      {% if docsroot %}
                                          &lt;a href="{{ docsroot }}"&gt;{% trans 'Documentation' %}&lt;/a&gt; /
                                      {% endif %}
                                  {% endif %}
                                  {% if user.has_usable_password %}
                                      &lt;a href="{% url 'admin:password_change' %}"&gt;{% trans 'Change password' %}&lt;/a&gt; /
                                  {% endif %}
                                  &lt;a href="{% url 'admin:logout' %}"&gt;{% trans 'Log out' %}&lt;/a&gt;
                              {% endblock %}
                          &lt;/div&gt;
                      {% endif %}
                  {% endblock %}
                  {% block nav-global %}{% endblock %}
              &lt;/div&gt;
              &lt;!-- END Header --&gt;
  
              {% block breadcrumbs %}
                  &lt;div class="breadcrumbs"&gt;
                  &lt;a href="{% url 'admin:index' %}"&gt;{% trans 'Home' %}&lt;/a&gt;
                  {% if title %} &amp;rsaquo; {{ title }}{% endif %}
                  &lt;/div&gt;
              {% endblock %}
  
              {% endif %}
  
              {% block messages %}
                  {% if messages %}
                      &lt;ul class="messagelist"&gt;{% for message in messages %}
                      &lt;li{% if message.tags %} class="{{ message.tags }}"{% endif %}&gt;{{ message|capfirst }}&lt;/li&gt;
                      {% endfor %}&lt;/ul&gt;
                  {% endif %}
              {% endblock messages %}
  
              &lt;!-- Content --&gt;
              &lt;div id="content" class="{% block coltype %}colM{% endblock %}"&gt;
              {% block pretitle %}{% endblock %}
              {% block content_title %}{% if title %}&lt;h1&gt;{{ title }}&lt;/h1&gt;{% endif %}{% endblock %}
              {% block content %}
              {% block object-tools %}{% endblock %}
              {{ content }}
              {% endblock %}
              {% block sidebar %}{% endblock %}
              &lt;br class="clear"&gt;
              &lt;/div&gt;
              &lt;!-- END Content --&gt;
  
              {% block footer %}&lt;div id="footer"&gt;&lt;/div&gt;{% endblock %}
  
          &lt;/div&gt;
          &lt;!-- END Container --&gt;
  
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Could anyone point out what I might be missing. I am using Django 2.1.2.</p>