Tastypie filtering with multiple values

nknj picture nknj · Jul 11, 2012 · Viewed 9.8k times · Source

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

Vinicius Cainelli picture Vinicius Cainelli · Jul 11, 2012

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}