Open daweedm opened 8 months ago
A solution for this would be to define a Mixin for the Admin class which defines the needed resources only once using the Media subclass.
I think you could try improve OnceCallMedia
Mixin will be required to make the filter work
I don't think that is a good idea
The DOM loading of list_filters is slowed down only when one ore more date range filters are used.
I think this is related to the scripts
<script src=...>
(and styles) that are defined in the following template :https://github.com/silentsokolov/django-admin-rangefilter/blob/ceb7ed7c750f496f400816760f465f76ad3017cd/rangefilter/templates/rangefilter/date_filter.html#L71-L146
This template is loaded for every "instance" of date filter and make the browser download the same scripts & css multiple times, which slows down the DOM rendering (mostly because of the repetition of scripts inside the HTML document).
A solution for this would be to define a Mixin for the Admin class which defines the needed resources only once using the Media subclass :
I can make a PR, but this will introduce breaking changes, since the inline scripts & resources will be removed from the
date_filter.html
template and the Mixin will be required to make the filter work.What do you think about it ? Maybe you have another solution for this ?