Tastypie filtering with multiple values

后端 未结 5 757
你的背包
你的背包 2020-12-28 19:02

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

5条回答
  •  醉酒成梦
    2020-12-28 19:24

    /api/v1/message/?accountId__in=1,5,12
    this is the right way to me, it is easy and straightforward.

    /api/v1/message/?accountId__in=1&accountId__in=5&accountId__in=12
    this way is strange and looks ugly.

    of course, you need to add filtering = { 'accountId' : ALL } in the resource META.

提交回复
热议问题