开发者

using comparisons in tastypie filters

how would i access the the url with comparisons in tastypie? for instance if my filters are 开发者_Python百科set up like this:

filtering = {
        "room"  :   ALL_WITH_RELATIONS,
        "date"  :   ['exact', 'range'],
        "time"  :   ['gte', 'lte']
    }

how would i specify the time-range i want in the GET request? i know that ?format=json&date=2011-01-01 will return all on that day, but to filter with comparisons doesn't work e.g. ?format=json&time<=08:00

obviously the comparisons arent triggered by using standard "<" ">" "<=" ">=" operators so what should i use?


You should use the same expression as in the django ORM:

...?format=json&time__lte=08:00&date=2011-01-01

http://django-tastypie.readthedocs.org/en/latest/resources.html#basic-filtering

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜