yyf248630
yyf248630
2019-04-10 10:34

<AttributeError: 'str' object has no attribute 'decode'>,跪求大神解答。

  • python
  • django
from django.db import models


# Create your models here.
class Grades(models.Model):
    gname = models.CharField(max_length=20)
    gdate = models.DateTimeField()
    ggirlnum = models.IntegerField()
    gboynum = models.IntegerField()
    isDelete = models.BooleanField(default=False)


class Students(models.Model):
    sname = models.CharField(max_length=20)
    sgender = models.BooleanField(default=True)
    sage = models.IntegerField()
    scontend = models.CharField(max_length=20)
    isDelete = models.BooleanField(default=False)
    # 关联外键
    sgrade = models.ForeignKey(Grades, on_delete=models.CASCADE)

Django2.2, python3.7, 执行数据库迁移时报错,

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐