nknj nknj - 3 years ago 97
reST (reStructuredText) Question

Tastypie filtering with multiple values

I had a simple question on filtering in tastypie.

I want to filter with multiple values. For example:

/api/v1/message/?accountId=1,5,12


This doesnt work. Any idea how i can do this?

Do i need to use advanced filtering? If yes, how do I go about creating such a filter? A simple effortless example of puesdo-code would be great!

Thanks!

Answer Source

Hmm,

You can do this:

/api/v1/message/?accountId__in=1&accountId__in=5&accountId__in=12

PS: in filtering meta attribute, add {'accountId': ALL}

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download