You solve it by doing what the Spec says: encode the "+" (same thing it is 
happening with space should Allen with your "+".)

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: [email protected] 
<[email protected]> on behalf of Daniel Gilge 
<[email protected]>
Sent: Monday, December 25, 2017 7:52:29 AM
To: Django REST framework
Subject: Filtering datetime as ISO 8601 in URL doesn't work

Hi,

I've got an issue I don't know where to ask (because there are Django, DRF and 
django-filter included) and how to handle it (I don't find a documentation or 
any issues on that) but I think this is the best place to start.

We have an API with a datetime field we want to filter with "greater than" 
using django-filter. That means we have an URL like 
/api/books/?published__gt=1994-11-05T08:15:30+05:00. That works fine as long as 
you don't have the "+" in the query value. (That means you can use timezones 
behind UTC ("-") and UTC with the "z" notation.)

My first question is:

1) Is ISO 8601 a good practice as query value in URIs? If not what is the best 
practice?

What happens is that Django's QueryDict is used which makes Use of Django's 
limited_parse_qsl (taken from some version of urlparse) which replaces the "+" 
by a " " (space) in query 
values<https://github.com/django/django/blob/master/django/utils/http.py#L425>.

2) How to solve this?

I've also created a test repository<https://github.com/dgilge/test_drf> to make 
sure that no other packages caused the problem.

--
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to