silentsokolov / django-admin-rangefilter

A Django app that lets you filter data by date range and numeric range in the admin UI
MIT License
721 stars 106 forks source link

Uncaught TypeError: django.jQuery is not a function #79

Closed petrastegaev closed 2 years ago

petrastegaev commented 2 years ago

The filter is not working, I keep getting following error when I click the button: Uncaught TypeError: django.jQuery is not a function at datefilter_apply ((index):659:30) at HTMLInputElement.onclick ((index):713:124)

I have tried adding Django-jquery, adding Media class, adding jQuery to template, nothing helps. I use default admin, Django 3.2.9.

petrastegaev commented 2 years ago

Fixed this by adding following two lines to change_list.html extension template, I believe it should be added to readme: <script src={% static 'admin/js/jquery.init.js' %}></script> <script src={% static 'admin/js/core.js' %}></script>

silentsokolov commented 2 years ago

I checked version 3.2.9 with latest rangefilter is works fine. Js scripts were load ... http://joxi.net/krDlByJIKPBqkr

Do you override default admin templates?

petrastegaev commented 2 years ago

Yes, change_list.html was extended. As I found out adding <script src={% static 'admin/js/jquery.init.js' %}> <script src={% static 'admin/js/core.js' %}> to custom change_list.html fixes the problem.