这就是我在 models.py 文件夹中所做的
class Product(models.Model):
name = models.CharField(max_length=200, null=True)
price = models.FloatField()
digital = models.BooleanField(default=False, null=True, blank=False)
image = models.ImageField(null=True, blank=True)
def __str__ (self):
return self.name
但是我在我的 django 管理页面中得到了这个结果 我想用他们的名字显示产品
PRODUCT
Product object (2)
Product object (1)
2 products