【发布时间】:2010-11-02 09:52:14
【问题描述】:
我更改了模型,同步了数据库,现在当我这样做时:
Prs = Products.objects.filter(PrName__icontains='bla')
我得到错误:
ERROR: column search_products.pr_name does not exist
LINE 1: SELECT "search_products"."id", "search_products"."pr_name", ...
但是 pr_name 是旧模型,这是新模型的样子:
class Products(models.Model):
PrName = models.CharField(max_length=255)
PrDescription = models.CharField(max_length=4000)
PrPrice = models.DecimalField(max_digits=5, decimal_places=2)
PrCompany = models.ForeignKey(Companies)
def __str__(self):
return self.PrName
为什么会出现这个错误?我同步了 db 100 次,检查了所有代码,没有任何地方引用 pr_name?
【问题讨论】: