silentsokolov / django-admin-rangefilter

A Django app that lets you filter data by date range and numeric range in the admin UI
MIT License
721 stars 106 forks source link

fix: Prevent datetimeshortcuts from rendering multiple times #129

Closed vxsx closed 3 months ago

vxsx commented 3 months ago

This was happening because scripts injected inside $(document).ready(...) would delay onload event and django's DateTimeShortcuts script attaches an event handler to load event to initialize the widgets. What would happen is our own initialization would run first and the one coming from django second resulting in duplicate widget. This change ensures our initialization happens last.

See #128

silentsokolov commented 3 months ago

I tested on Firefox / Chrome / Safari, everything is ok Thank you!