Can make migration in django
i cant migrate this model in django
class ApprovedCourse(models.Model):
course_name = models.CharField(max_length=50)
provider_college = models.ManyToManyField('processes.College', related_name="provider_college")
prerequisites = models.ManyToManyField('ApprovedCourse', related_name="courses_that_need_this_course",null=True)
both_needs = models.ManyToManyField('ApprovedCourse', related_name="courses_required_for_this_course",null=True)
number_of_course_units = models.IntegerField()
course_type = models.CharField(max_length=50)
class SemesterCourse(models.Model):
approved_course=models.ForeignKey('ApprovedCourse', on_delete=models.CASCADE , null=True, related_name='approved_course')
class_day_and_time = models.CharField(max_length=50)
exam_date_and_time = jmodels.jDateTimeField()
exam_location = models.CharField(max_length=50)
course_professor = models.ForeignKey('users.Professor', on_delete=models.SET_NULL, null=True, related_name="professor_course")
course_capacity = models.IntegerField()
current_semester = models.ForeignKey('processes.Semester', on_delete=models.SET_NULL, null=True, related_name="semester_course")
when i want to add approved_course filed and makemigration it said this message Please select a fix:
- Provide a one-off default now (will be set on all existing rows with a null value for this column)
- Quit and manually define a default value in models.py. Select an option:
how can i solve it?
Yess Surly.... You can migrate your created models to back admin by following command:
python manage.py makemigration
python manage.py migrate