Open AliPolat opened 4 years ago
Hi AliPolat,
I collect the snippets in this repository and I adapt them, and updates them, when I reuse them. I'm not using menu filter collapse from 2017 and I don't know when I'll use it again. I'm very sorry
Thank you for this kind reply. For your future referance it works on Django 2.1
@AliPolat and @peppelinux - FYI - Django 2.2. release now required specifying additional files that are dependencies within the Media class: https://docs.djangoproject.com/en/3.0/releases/2.2/#merging-of-form-media-assets
Form Media assets are now merged using a topological sort algorithm, as the old pairwise merging algorithm is insufficient for some cases. CSS and JavaScript files which don’t include their dependencies may now be sorted incorrectly (where the old algorithm produced results correctly by coincidence).
Audit all Media classes for any missing dependencies. For example, widgets depending on django.jQuery must specify
js=['admin/js/jquery.init.js', ...]
when declaring form media assets.
For instance, whereas before django 2.2 you could, add the Media class to a ModelAdmin class like so:
@admin.register(Articles)
class ArticleAdmin(admin.ModelAdmin):
class Media:
js = ['js/list_filter_collapse.js']
Now you must also specify its dependent code. E.g.
@admin.register(Articles)
class ArticleAdmin(admin.ModelAdmin):
class Media:
js = ['admin/js/jquery.init.js', 'js/list_filter_collapse.js']
This worked for me on django 2.2.
Yes, now I remember. We have to put jquery.init.js as first element in the list otherwise Django will load it after our custom js (that fails cause of the missing jquery init).
I think to not close this issue as a useful back reference. Thank you
This code does not minimize the admin list filter after upgrading to django 2.2.