Commit 6db18a40 authored by Daniel W Bond's avatar Daniel W Bond

additional comments explaining exactly how django.jQuery works and the...

additional comments explaining exactly how django.jQuery works and the importance of js library load order (which screwed me up yesterday)
parent 149edf69
Pipeline #2193 passed with stage
in 3 minutes and 19 seconds
......@@ -7,7 +7,10 @@
<script type="text/javascript" src="{% static "admin/js/vendor/jquery/jquery.min.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/vendor/select2/select2.full.min.js" %}"></script>
<!-- Django changes jQuery to django.jQuery in case the version bundled with Django is not the version
you want to use in your app -->
you want to use in your app
It's super important that it is loaded after the jQuery library, and
any jQuery-reliant libraries are loaded-->
<script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
<script type="text/javascript" src="{% static "admin/js/cancel.js" %}"></script>
<script>
......@@ -30,6 +33,7 @@
$(document).ready(function() {
$('.select2-basic-single').select2();
});
// note how this is wrapped in a function to use django.jQuery for references to $
})(django.jQuery);
</script>
{{ block.super }}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment