📌  相关文章
📜  如何在 manytomany django 中进行用户过滤 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:03.951000             🧑  作者: Mango

代码示例1
users_in_1zone = User.objects.filter(zones__id=)
# same thing but using in
users_in_1zone = User.objects.filter(zones__in=[])

# filtering on a few zones, by id
users_in_zones = User.objects.filter(zones__in=[, , ])
# and by zone object (object gets converted to pk under the covers)
users_in_zones = User.objects.filter(zones__in=[zone1, zone2, zone3])