Here are the models:
class Teacher(models.Model):
login = models.CharField(max_length=10, primary_key=True)
fname = models.CharField(max_length=30)
mname = models.CharField(max_length=30)
lname = models.CharField(max_length=30)
class Course(models.Model):
semester = models.ForeignKey(Semester, on_delete=models.CASCADE)
title = models.CharField(max_length=40)
teachers = models.ManyToManyField(Teacher.login, through='TeacherCourse')
credits = models.IntegerField()
numberEnrolled = models.IntegerField()
nomenclature = models.CharField(max_length=128)
lectures = models.IntegerField()
class TeacherCourse(models.Model):
teacher = models.ForeignKey(Teacher.login, on_delete=models.CASCADE)
course = models.ForeignKey(Course, on_delete=models.CASCADE)
allotedLectures = models.IntegerField()
Just added these to fresh project and tried to runserver. I'm getting the following:
AttributeError: type object 'Teacher' has no attribute 'login'
I'm missing something obvious?