django.db.utils.OperationalError:没有这样的列:home_student.schoolYear

问题描述 投票:0回答:1

models.py '''

class Person(models.Model): 
    firstname = models.CharField(max_length=30)
    lastname = models.CharField(max_length=30)
    othernames = models.CharField(max_length=40)
    dateOfBirth = models.DateField()
    gender = models.CharField(max_length=20)
    birthGender = models.CharField(max_length=20)
    email = models.EmailField(max_length=100)
   
class Student(Person):
    studentId = models.IntegerField()
    admissionDate = models.DateField()
    enrolmentStatus = models.BooleanField()
    studentExamCode = models.IntegerField()
    schoolYear = models.IntegerField()

'''

forms.py'''

class studentF(ModelForm):
class Meta:
    model = Student
    fields = ['firstname', 'lastname', 'othernames', 'dateOfBirth', 'gender', 'birthGender', 'email', 'studentId', 'admissionDate', 'enrolmentStatus', 'studentExamCode', 'schoolYear']
    

'''

我收到标题中的错误,如何解决?

python django backend
1个回答
0
投票

确保你已经做了@raphael 说你应该做的事情。如果问题仍然存在,

python manage.py makemigrations --merge
python manage.py migrate --fake
© www.soinside.com 2019 - 2024. All rights reserved.