Django-filter: _before and _after suffixes for DateTimeFromToRangeFilter do not work

Created on 29 Nov 2017  路  3Comments  路  Source: carltongibson/django-filter

I am unable to use the _before and _after suffixes for a DateTimeFromToRangeFilter. My FilterSet contains:

updated_at = filters.DateTimeFromToRangeFilter()

but if I make a request via an external script using GET params 'updated_at_before' and 'updated_at_after', the filtering doesn't work. If i use the Filter in the DRF UI for that field (MultiWidget I assume), it generates a query with the params 'updated_at_0' and 'updated_at_1' respectively. I altered the script and confirmed that this works, albeit a rather inconvenient workaround that isn't reflected in the docs.

Here's an excerpt of my pip freeze:
Django==1.11.7
django-auth-ldap==1.3.0
django-cors-headers==2.1.0
django-extensions==1.9.7
django-filter==1.1.0
django-jsonfield==1.0.1
django-nose==1.4.5
django-rest-framework==0.1.0
django-rest-swagger==2.1.2
django-storages==1.6.5
djangorestframework==3.7.3
djangorestframework-jwt==1.11.0

And this is on Python 2.7.14. Thanks for your help!

Most helpful comment

@rpkilby That's...

  1. Possible.
  2. Extremely easy
  3. Now done.

馃榾

All 3 comments

You鈥檙e looking at the docs for master which represents the upcoming 2.0 release. Switch to the 1.1 docs and all will work.

@carltongibson I'm not sure if it's possible, but it might be helpful if the default version on RTD could be changed to 1.1.0 instead of master/2.x. Alternatively, we could add a temporary note on the index page, directing users to http://django-filter.readthedocs.io/en/1.1.0/

@rpkilby That's...

  1. Possible.
  2. Extremely easy
  3. Now done.

馃榾

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jwineinger picture jwineinger  路  3Comments

edmorley picture edmorley  路  3Comments

lalzada picture lalzada  路  3Comments

GuillaumeCisco picture GuillaumeCisco  路  3Comments

chromakey picture chromakey  路  5Comments