标题可能看起来有点混乱。然而,我想做的很简单。我有以下型号:
class ListEntry(models.Model):
name = models.CharField(max_length=64)
expire_date = models.DateField('date of expiration')
create_date = models.DateField('date created')
class ListWarning(models.Model):
mailing_list = models.ForeignKey(ListEntry)
first_warning = models.BooleanField()
last_warning = models.BooleanField()
我想查询引用具有特定名称的邮件列表的列表警告对象。下面是一个例子:
first_warning_list = ListWarning.objects.filter(mailing_list.name='PH_212', first_warning=True, last_warning=False)
然而,出于某种原因,python抱怨语法错误:
first_warning_list = ListWarning.objects.filter(mailing_list.name='PH_212', first_warning=True, last_warning=False)
SyntaxError: keyword can't be an expression
执行此查询的语法正确方法是什么
使用双下划线而不是点符号来表示邮件列表名称
文件here.
相关问题 更多 >
编程相关推荐