首页 > 解决方案 > 我正在尝试使用文本选择,但收到此错误 - python 'appstat' 无法转换为 MySQL 类型”,无

问题描述

我收到此错误:

django.db.utils.ProgrammingError:(-1, "Failed processing format-parameters; P)

这是错误所在的models.py:

class Person(models.Model):
    class AppStat(models.TextChoices):
        Submitted = 'SUB', ('Submitted')
        HRREV = 'HR', ('HR Reviewed')
        Contacted = 'CON', ('Contacted')
        Accepted = 'AC', ('Accepted')
        Rejected= 'REJ', ('Rejected')

它在本地环境中运行良好,但是当我使用 mysql 连接器移动到 docker 容器中的环境时,它就不行了。

Exception Value:    
(-1, "Failed processing format-parameters; Python 'appstat' cannot be converted to a MySQL type", None)

标签: djangomodel

解决方案


推荐阅读