我更改了模型,同步了数据库,现在当我这样做时:
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?