codingjoe / django-select2

This is a Django integration for Select2
https://django-select2.rtfd.io
MIT License
172 stars 52 forks source link

Fix #292 -- Change admin widgets' JS media ordering #295

Closed mardukbp closed 3 months ago

mardukbp commented 3 months ago

Select2Mixin now loads admin/js/jquery.init.js, just like the AutocompleteMixin of Django Admin. Fixes #292.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.23%. Comparing base (f61b09c) to head (7fdcd24). Report is 15 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #295 +/- ## ========================================== + Coverage 98.21% 98.23% +0.02% ========================================== Files 7 7 Lines 280 284 +4 ========================================== + Hits 275 279 +4 Misses 5 5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codingjoe commented 3 months ago

@mardukbp I made an amendment to your patch and moved the behavior to the admin mixin only. Can you double-check if that works for you?

mardukbp commented 2 months ago

@codingjoe It does not work. Why did not you wait for my reply? Why did you modify my PR, when I had already tested that it solves the problem? Please use my original code.

codingjoe commented 2 months ago

Hi there,

Don't take this wrong, but I maintain dozens of packages. I don't remember why, I did something 3 weeks ago. Upon reviewing your code again, it wasn't something I would have merged. You modified the base widget that shouldn't implement anything specific to Django's admin. Which you may have noticed because all tests related to that were failing.

Please check if you are using the admin mixin, that is required to make select2 work in Django's admin. If the error persists, please open a new ticket.

Kindly, Joe

mardukbp commented 2 months ago

Thank you for your prompt and careful reply. I appreciate that you take the time to respond quickly. I agree that my modification was not done at the right place and the right place is the AdminMixin.

I think that as a maintainer you should merge PRs only when there's convincing evidence that they solve a problem and not rush to get rid of open PRs. Now we have to start all over again with another issue and another PR, which costs both of us time. In other words, I appreciate your dilligence, but don't be too efficient :)

mardukbp commented 2 months ago

It turns out the fix works as expected. In all my projects I use Jazzmin, which activates Select2 for all select widgets and it interferes with django-select2. My apologies for not doing proper testing before commenting.