[Fixed]-Uncaught ReferenceError: django is not defined

40👍

django.jQuery is defined in django/contrib/admin/static/admin/js/jquery.init.js and relies on django/contrib/admin/static/admin/js/jquery.js. You need to load those js files in your template directly

<script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>

Or include those files in your form media

Also check the media property of ModelAdmin.

👤okm

2👍

I solve it by this way:

class CustomIndexDashboard(Dashboard):
    class Media:
        js = ('admin/js/vendor/jquery/jquery.min.js', 'admin/js/jquery.init.js')
👤VSKut

Leave a comment