Django 1.10 UUIDField全文搜索返回数据

2024-04-26 18:07:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我有以下型号:

class Show(models.Model):
    cid = models.UUIDField(
        default=uuid.uuid4,
        editable=False,
        verbose_name="Content ID",
        help_text="Unique Identifier"
    )
    title_short = models.CharField(
        max_length=60,
        blank=True,
        verbose_name="Short Title",
        help_text="Short title (60 chars)"
    )

我用下面的片段

^{pr2}$

退货:

DataError at /meta/shows/

invalid input syntax for uuid: ""
LINE 1: ...unt", to_tsvector(COALESCE("entities_show"."cid", '')) AS    "s...

我尝试使用postgresql9.3.14和postgresql9.5.3、python3.4.3

有人遇到过这个问题吗?在


Tags: textnamedefaultverbosemodeluuidtitlemodels
1条回答
网友
1楼 · 发布于 2024-04-26 18:07:07

您可能需要提交一个错误报告。在

Django代码创建COALESCE()语句,假设空字符串('')的最终回退值对于给定的字段是可接受的。 我看不到通过官方API指定回退值的方法,而且由于UUID字段被转换为Postgres本机UUID字段,因此空字符串对于该字段来说是无效的。在

如果你决定提交一个报告,请在这里添加一个带有票证ID的评论,我可能会致力于修复它,因为我对这个功能有着既得利益。在

相关问题 更多 >