Added __str__ to models in Assignment and Homepage

parent 0629b161
......@@ -9,6 +9,9 @@ class Course(models.Model):
@property
def course_info(self):
return '{} {} {}'.format(self.course_code, self.course_title, self.section)
def __str__(self):
return '{} {}'.format(self.course, self.section)
class Assignment(models.Model):
name = models.CharField(max_length=50)
......@@ -29,4 +32,7 @@ class Assignment(models.Model):
assignment += '<br>Passing Score: {}'.format(self.passing_score)
assignment += '<br>Course/Section: {}<br>'.format(self.course.course_info)
return assignment
\ No newline at end of file
return assignment
def __str__(self):
return '{} - {}'.format(self.name, self.course.__str__)
\ No newline at end of file
No preview for this file type
......@@ -8,6 +8,9 @@ class Department(models.Model):
@property
def dept_info(self):
return '{}, {}'.format(self.dept_name, self.home_unit)
def __str__(self):
return '{}'.format(self.dept_name)
class WidgetUser(models.Model):
first_name = models.CharField(max_length=50)
......
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