Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Aug 9, 2024

Conversation

mardukbp
Copy link

@mardukbp mardukbp commented Aug 5, 2024

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

@codingjoe codingjoe changed the title Fix i18n by loading all necessary JS dependencies Fix #292 -- Change admin widgets' JS media ordering Aug 8, 2024
django_select2/forms.py Outdated Show resolved Hide resolved
django_select2/forms.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codingjoe
Copy link
Owner

@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?

@codingjoe codingjoe merged commit 50c488c into codingjoe:main Aug 9, 2024
23 checks passed
mardukbp added a commit to mardukbp/django-select2 that referenced this pull request Aug 29, 2024
…oe#295)

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

---------

Co-authored-by: Johannes Maron <[email protected]>
@mardukbp
Copy link
Author

@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
Copy link
Owner

codingjoe commented Aug 29, 2024

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
Copy link
Author

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

i18n is broken due to missing jQuery import in media 🐛
2 participants