[英]django.core.exceptions.ValidationError value must be a decimal number
[英]django.core.exceptions.ValidationError: ['“” value must be a decimal number.']
迁移时出现此错误是我的 models.py 文件:
from django.db import models
from django.conf import settings
from decimal import Decimal
# Create your models here.
class Pharmacy(models.Model):
user=models.ForeignKey(settings.AUTH_USER_MODEL,
on_delete=models.CASCADE)
Title = models.CharField(max_length=200)
description=models.TextField()
feed=models.DecimalField(max_digits=5,decimal_places=1,default=Decimal('1.0'),null=True)
def __str__(self):
return self.Title
class feedback(models.Model):
phid=models.ForeignKey(Pharmacy,on_delete=models.CASCADE)
value=models.DecimalField(max_digits=5.,decimal_places=0,default=Decimal('1.0'),null=True)
django.core.exceptions.ValidationError: ['“” value must be a decimal number.']
我做了没有错误的迁移
max_digits=5.
=> max_digits=5
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.