Opened 6 years ago

Closed 6 years ago

#30496 closed Bug (invalid)

Broken order for class Media

Reported by: Den Owned by: nobody
Component: Forms Version: 2.2
Severity: Normal Keywords: media widget
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Djnango 2.2.1, python3.7

class ProductAdmin(admin.ModelAdmin):
    class Media:
        js = ['admin_ext/init.js', 'admin_ext/classes.js',
              'admin_ext/common.js']

I get this html

<script type="text/javascript" src="/frm-admin/jsi18n/"></script>
<script type="text/javascript" src="/static/admin/js/vendor/jquery/jquery.js"></script>
<script type="text/javascript" src="/static/admin_ext/init.js"></script>
<script type="text/javascript" src="/static/ckeditor/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/static/admin_ext/files/images_inline.js"></script>
<script type="text/javascript" src="/static/admin/js/jquery.init.js"></script>
<script type="text/javascript" src="/static/admin_ext/classes.js"></script>
<script type="text/javascript" src="/static/admin_ext/contrib/ckeditor/widget.js"></script>
<script type="text/javascript" src="/static/admin/js/core.js"></script>
<script type="text/javascript" src="/static/admin_ext/common.js"></script>
<script type="text/javascript" src="/static/admin/js/inlines.js"></script>
<script type="text/javascript" src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/admin/js/actions.js"></script>
<script type="text/javascript" src="/static/admin/js/urlify.js"></script>
<script type="text/javascript" src="/static/admin/js/prepopulate.js"></script>
<script type="text/javascript" src="/static/admin/js/vendor/xregexp/xregexp.js"></script>

"/static/admin_ext/init.js" goes after "/static/admin/js/vendor/jquery/jquery.js", but i expect "/static/admin/js/jquery.init.js" and other django scripts

django==2.1.8 - it`s ok

forms.widgets.Media.merge changed in 2.2 version

Change History (1)

comment:1 by Simon Charette, 6 years ago

Resolution: invalid
Status: newclosed

This is a documented change of 2.2.

For example, widgets depending on django.jQuery must specify js=['admin/js/jquery.init.js', ...] when declaring form media assets.

In summary if you expect 'admin/js/jquery.init.js' to be included before 'admin_ext/init.js' you must make sure to include it in your js before the latter

Note: See TracTickets for help on using tickets.
Back to Top