【发布时间】:2018-11-07 13:27:14
【问题描述】:
我的模式中有一个名为technology 的listTextField。如果technology 字段中存在每个数组值,我想根据数组过滤对象。
tech = ['a','b',....] #dynamic list
mentors_list = Mentor.objects.filter(
**{"technology__contains" : value for value in tech}) #this doesn't work
导师班有(在其他领域):
class Mentor(Meta):
technology = ListTextField(
base_field=models.CharField(max_length=20),
size=10, max_length=(10 * 11))
基本上我想要mentor_list 中的所有对象,其technology 字段必须包含来自tech 数组的所有值(但可能包含一些额外的值)。
【问题讨论】:
标签: python django django-models filter orm