stephenmcd / mezzanine

CMS framework for Django
http://mezzanine.jupo.org
BSD 2-Clause "Simplified" License
4.75k stars 1.64k forks source link

add a minified version of the collapse so non-debug mode works #2033

Closed caffodian closed 2 years ago

caffodian commented 2 years ago

Fixes #2005 - Per https://github.com/stephenmcd/mezzanine/issues/2005#issuecomment-1061264104 , when Django is running in non-debug mode, it incorrectly tries to load Django's version of collapse.js, because we don't have a minified version. Since the file is pretty small I ended up just minifying it via the uglify website. I'm not sure if there's a preferred minifier here.

My prior notes:

this is how django decides which version of the collapse.js to load: https://github.com/django/django/blob/119f227aa62885f12cd7dd2558a62148d02adbb4/django/contrib/admin/options.py#L2327

Collapse.min.js is actually pre-minified and included in the Django package: https://github.com/django/django/blob/cab36618326524b336517c2c5fd62633916818e0/django/contrib/admin/static/admin/js/collapse.min.js

Since there's no minified version of that file included here, the minified Django collapse.min.js will be picked up instead of the unminified collapse.js here.

and i guess prior to this PR: https://github.com/stephenmcd/mezzanine/commit/95b138a961d5a102cfe79ed792cba1e9b93d134a it would have still worked because it'd load the minified django collapse + the unminified mezzanine collapse still.


Thanks!

caffodian commented 2 years ago

@jerivas - I saw you looked at the issue for this (https://github.com/stephenmcd/mezzanine/issues/2005) - could you please check my explanation to see if it makes sense, and if there any chance this fix could be included in a release anytime soon? (I'd like to avoid forking if possible, but we have some customers asking about this.)

thanks!

caffodian commented 2 years ago

Oh wait! This stopped being an issue in Django 3.2 because the collapse isn't in the list of js here: https://github.com/django/django/blob/stable/3.2.x/django/contrib/admin/options.py#L651

caffodian commented 2 years ago

This might still be worth it for 2.2 compat reasons, but doesn't affect me personally anymore....sorry for the needless tag

henri-hulski commented 2 years ago

Django 2.2 is already end-of-life.