modlinltd / django-advanced-filters

Add advanced filtering abilities to Django admin
https://pypi.org/project/django-advanced-filters/
MIT License
771 stars 173 forks source link

Advanced filter popup not opening with django-grappelli installed #49

Closed lazygalminion closed 7 years ago

lazygalminion commented 7 years ago

Hi, I have installed django-grappelli followed by django-advanced-filters. Although I see the "Advanced Filters" button, it does not open a popup on clicking it. would be of great help if someone can help me with this. Thanks

Zax337 commented 7 years ago

Hey, can't really help, but I've got the same problem here.

asfaltboy commented 7 years ago

Hi, my apologies for delay in response, I must have missed this issue. Can either of you revert with your version of Django/Python and which version of django-advanced-filters you are using?

I have a feeling you're on Django > 1.10 and experiencing issue #48. You can try and install the develop branch directly to test out the solution.

Zax337 commented 7 years ago

Hi, thanks for the fast (at least for me :smile: ) answer. I'm using python 3.5.2 with Django 1.11.4 (so indeed, > 1.10) and django-advanced-filters version 1.0.5. I just tried the develop branch but it doesn't seem to fix it. = /

The main error I can see is TypeError: $ is not a function in advanced-filters.js:147:2 which refers to:

// using Grappelli's jquery if available
(function($) {
    $(document).ready(function() {
        if (!_af_handlers) {
            _af_handlers = new OperatorHandlers($);
            _af_handlers.destroy()
            _af_handlers.init();
        }
    });
})(window._jq || jQuery);

I have no clue how I can help you best so don't hesitate to ask me for more details.

asfaltboy commented 7 years ago

Thanks @Zax337 , can you please try the branch feature/grappelli-add-jquery-global? It seems grappelli remove the global jQuery variable, which breaks loading for magnific-popup and select2 packages, both of which we use.

Zax337 commented 7 years ago

Thanks a lot @asfaltboy, it indeed fixes the issue!

Zax337 commented 7 years ago

Hey,

Do you have an ETA of when this fix will reach master? Thanks!

asfaltboy commented 7 years ago

@Zax337 sure we can probably release by this weekend

Zax337 commented 7 years ago

Perfect, thanks again!

asfaltboy commented 7 years ago

@Zax337 just to update, release 1.0.6 has happened! 🎉

Zax337 commented 7 years ago

Yay, I've seen that, thanks again! :tada: :tada: