Added __str__ to models in Assignment and Homepage

parent 0629b161
......@@ -10,6 +10,9 @@ class Course(models.Model):
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)
description = models.CharField(max_length=500)
......@@ -30,3 +33,6 @@ class Assignment(models.Model):
assignment += '<br>Course/Section: {}<br>'.format(self.course.course_info)
return assignment
def __str__(self):
return '{} - {}'.format(self.name, self.course.__str__)
\ No newline at end of file
No preview for this file type
......@@ -9,6 +9,9 @@ class Department(models.Model):
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)
middle_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