Commit 11fb173d authored by Joan Denise Nocos's avatar Joan Denise Nocos

fix: Course objects now have unique names that indicate the course code,...

fix: Course objects now have unique names that indicate the course code, course title, and course section
parent eea7aedf
...@@ -7,6 +7,9 @@ class Course(models.Model): ...@@ -7,6 +7,9 @@ class Course(models.Model):
course_title = models.CharField(max_length=255) course_title = models.CharField(max_length=255)
section = models.CharField(max_length=3) section = models.CharField(max_length=3)
def __str__(self):
return self.course_code + '/' + self.course_title + '/' + self.section
class Assignment(models.Model): class Assignment(models.Model):
course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True) course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True)
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
...@@ -15,7 +18,7 @@ class Assignment(models.Model): ...@@ -15,7 +18,7 @@ class Assignment(models.Model):
passing_score = models.IntegerField(default=0) passing_score = models.IntegerField(default=0)
image = models.FileField(upload_to='static/assignments/', null=True) image = models.FileField(upload_to='static/assignments/', null=True)
def _str_(self): def __str__(self):
return self.name return self.name
def file(self): def file(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment