dal_admin_filters
dal_admin_filters copied to clipboard
prepends "/?=undefined&" in url, removes all filters and redirect to "?e=1"
If I set a datetime or a date filter as frst selection
/?creation_date__gte=2017-03-08+00%3A00%3A00%2B01%3A00&creation_date__lt=2017-03-16+00%3A00%3A00%2B01%3A00
then if I select a dal admin filters of mine the new window location is:
/?=undefined&creation_date__gte=15%2F03%2F2017&creation_date__lte=15%2F03%2F2017&tipo_marketing=3
the erroneous "/?=undefined&" drive the window location in a new url with "?e=1" and all the previosly selected filters removed.
This happens only if a datetime filter preceeds a dal filter, if other sequence of filter appended in url this bug will not be raised.
Actually tested on two different Django platforms
Th bug appears when in the url, in window.location.search, the date filters contains hours and minutes notation lke the previouse examples or a & as prefix, like this example:
?&creation_date__gte=16%2F03%2F2017&creation_date__lte=16%2F03%2F2017
The previous bug disappears if the window.location.search is like this: /?creation_date__gte=2017-03-08&creation_date__lt=2017-03-16
I fixed this bug in js file querystring.js, at line 48, this way:
for (var i = 0; i < q.length; i++) {
// prevents undfined "?e=1" redirects
if (q[i].length < 1) { continue; }