我的 django 应用程序和带有 slug 字段的 POSTGRESQL 数据库有问题。错误:value too long for type character varying(1)我使用 sqlite 数据库测试我的应用程序,一切正常,但我的应用程序在 postgresql 数据库中不起作用。任何想法为什么会这样?测试 1:class MyModel(models.Model): name = models.CharField(max_length=254) slug_name = models.SlugField(max_length=254) def save(self, *args, **kwargs): self.slug_name = slugify(self.name) super(MyModel, self).save(*args, **kwargs)测试 2:class MyModel(models.Model): name = models.TextField(max_length=500) slug_name = models.SlugField(max_length=500) def save(self, *args, **kwargs): self.slug_name = slugify(self.name) super(MyModel, self).save(*args, **kwargs)测试 3:class MyModel(models.Model): name = models.TextField() slug_name = models.SlugField() def save(self, *args, **kwargs): self.slug_name = slugify(self.name) super(MyModel, self).save(*args, **kwargs)
添加回答
举报
0/150
提交
取消