#30153: ModelAdmin with custom widgets, inlines, and filter_horizontal can merge media in broken order -------------------------------+------------------------------------ Reporter: roybi | Owner: nobody Type: Bug | Status: new Component: contrib.admin | Version: 2.1 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------+------------------------------------
Comment (by Matthias Kestenholz): It seems to me that Django assumes too much. Here are some assets that have been collected in my case: {{{ [ 'imagefield/ppoi.js', <JS(ckeditor/ckeditor-init.js, {'id': 'ckeditor-init-script', 'data- ckeditor-basepath': '/static/ckeditor/ckeditor/'})>, 'ckeditor/ckeditor/ckeditor.js', 'admin/js/vendor/jquery/jquery.js', 'admin/js/jquery.init.js', 'admin/js/core.js', 'admin/js/admin/RelatedObjectLookups.js', 'admin/js/actions.js', 'admin/js/urlify.js', 'admin/js/prepopulate.js', 'admin/js/vendor/xregexp/xregexp.js', <JS(https://use.fontawesome.com/releases/v5.3.1/js/all.js, {'async': 'async', 'integrity': 'sha384-kW+oWsYx3YpxvjtZjFXqazFpA7UP/MbiY4jvs+RWZo2+N94PFZ36T6TFkc9O3qoB', 'crossorigin': 'anonymous'})>, 'app/plugin_buttons.js', 'admin/js/calendar.js', 'admin/js/admin/DateTimeShortcuts.js' ] }}} The `imagefield` and `ckeditor` assets are there because of widgets. When using the same widgets in inlines the inlines' `Media` class will contain `jquery`, `jquery.init.js`, `inlines.js`, `imagefield/ppoi.js`. When merging the two JS lists Django will find that `imagefield/ppoi.js` is at index 0, will continue with `inlines.js` (and of course not find it) and insert it at index 0 as well (because that's the value of `last_insert_index` now). As soon as `jquery.init.js` is encountered it notices that something is amiss and emits a `MediaOrderConflictWarning`. The problem was produced one iteration earlier and the error message is not very helpful. I don't have a good suggestion yet. It also baffles me that only one of two candidate models/modeladmins shows the problem, and (for now) luckily only in development. -- Ticket URL: <https://code.djangoproject.com/ticket/30153#comment:4> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/065.0921e5f0e0653ad9230fc728f4c65f88%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.