You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While that method works, I wanted more than just 'exact' matching, so I replaced: fields = ['published']
with: fields = {'published': ['exact', 'gte', 'lte']}
This still works for 'exact' filtering with an IsoDateTime, but for 'gte' and 'lte', it fails when using an IsoDateTime. It works when using a DateTime.
I am using a workaround at the moment which does work with IsoDateTime by specifying each lookup seperately:
Hmmm. My first response it to just accept this as a limitation of the dictionary fields syntax. Declaring fields explicitly — your "workaround" — is the canonical way to do it. The dictionary syntax is just a shortcut, and there's no problem with it having limitations.
Having said that, I'd take a change with a small footprint to "fix" this...
@carltongibson I'm happy with accepting the limitation. I tried looking for a quick "fix" but my understanding of the inner workings of the code is too limited at the moment :/
@rpkilby Thanks, your suggestion works well, I'll use that going forward :)
@carltongibson Would you like to note this limitation in the docs? I'm happy to make a pull request for it if you think it's appropriate.
I've been trying to implement the filtering described here: http://django-filter.readthedocs.io/en/develop/ref/filters.html#isodatetimefilter
While that method works, I wanted more than just 'exact' matching, so I replaced:
fields = ['published']
with:
fields = {'published': ['exact', 'gte', 'lte']}
This still works for 'exact' filtering with an IsoDateTime, but for 'gte' and 'lte', it fails when using an IsoDateTime. It works when using a DateTime.
I am using a workaround at the moment which does work with IsoDateTime by specifying each lookup seperately:
The text was updated successfully, but these errors were encountered: