sw00
sw00

Reputation: 980

using comparisons in tastypie filters

how would i access the the url with comparisons in tastypie? for instance if my filters are 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?

Upvotes: 0

Views: 2714

Answers (1)

rewritten
rewritten

Reputation: 16435

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

Upvotes: 2

Related Questions