我正在尝试解决Django中遇到的此错误。有人知道我在做什么错吗?谢谢哟!
错误消息:
select
模型:
django.db.utils.ProgrammingError: operator does not exist: bigint = boolean
LINE 1: ... 'economy' AND "landingpage_profile"."hasArticle" = true) OR...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts
我的查询集:
class Profile(models.Model):
...
hasArticle = models.BooleanField()
...
我也尝试过:
if hasArticle =="ALL":
queryset_list = queryset_list
elif hasArticle =="ALREADY CONTRIBUTED":
queryset_list = queryset_list.filter(hasArticle=1)
elif hasArticle =="NEVER CONTRIBUTED":
queryset_list = queryset_list.filter(hasArticle=0)
通过API转储我的数据可以做到这一点:
elif hasArticle =="ALREADY CONTRIBUTED":
queryset_list = queryset_list.filter(hasArticle=True)
elif hasArticle =="NEVER CONTRIBUTED":
queryset_list = queryset_list.filter(hasArticle=False)