【发布时间】:2020-08-16 15:58:30
【问题描述】:
我有 django 项目,我有像下面这样的图像域
certificate = models.ImageField(null=True, blank=True, max_length=1000)
但我需要将图像字段更改为外键 UUID,如下所示
certificate = models.ForeignKey(Certificates, null=True, blank=True, on_delete=models.CASCADE)
但我遇到如下迁移错误,
Applying templates.0016_auto_20200502_0452...Traceback (most recent call last):
File "/home/sakthips/.local/lib/python3.6/site-packages/django/db/backends/utils.py", line 85, in _execute
return self.cursor.execute(sql, params)
psycopg2.DataError: invalid input syntax for type uuid: ""
这个错误有点奇怪,谁能帮我解决。我知道我可以删除现有字段并添加新字段,这是一种解决方案。我期待其他一些解决方案。
【问题讨论】:
标签: django postgresql django-migrations