Filter for datetime field fails with string convertion with UTC timezone and plus sign (bug?) #7948
Unanswered
aemitos
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
It's not really a "bug" given plusses are supposed to be interpreted as spaces in query strings https://developers.google.com/maps/url-encoding. my workaround:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
We implemented a test that was using naive datetime to filter. Once we made it timezone aware using
timezone.now()
the string used on the URL became like this:We can see that the offset was added with a
+
.That returns for us an error (400) indicating that we provided an invalid date/time option to the filter.
When I checked the
django_filters.rest_framework.backends.py
, the method:The kwargs looked like this:
We can see on the
data
that the parsing removed the+
and added space.That doesn't happen with timezones that have a negative offset (example: "-04:00").
We didn't set the
REST_FRAMEWORK.DATETIME_FORMAT
and our view set looks like this:As mentioned above, the same doesn't happen for timezones with a negative offset.
Is this a bug?
Beta Was this translation helpful? Give feedback.
All reactions