Populated models and fixed formatting for Assigmments and Homepage

parent 0df07f44
......@@ -10,8 +10,12 @@ class Course(models.Model):
def course_info(self):
return '{} {} {}'.format(self.course_code, self.course_title, self.section)
@property
def course_shorthand(self):
return '{} {}'.format(self.course_code, self.section)
def __str__(self):
return '{} {}'.format(self.course, self.section)
return '{} {}'.format(self.course_code, self.section)
class Assignment(models.Model):
name = models.CharField(max_length=50)
......@@ -35,4 +39,4 @@ class Assignment(models.Model):
return assignment
def __str__(self):
return '{} - {}'.format(self.name, self.course.__str__)
\ No newline at end of file
return '{} - {}'.format(self.name, self.course.course_shorthand)
\ No newline at end of file
No preview for this file type
......@@ -22,9 +22,6 @@ class WidgetUser(models.Model):
department = models.ForeignKey(Department, on_delete = models.CASCADE)
def __str__(self):
return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name)
@property
def forum_name(self):
return '{} {}'.format(self.first_name, self.last_name)
......@@ -32,4 +29,10 @@ class WidgetUser(models.Model):
@property
def user_info(self):
return '<br>{}: {}, {}, {}'.format(self.__str__, self.id_num, self.email, self.department.dept_info)
\ No newline at end of file
user = '<br>{}, {} {}: '.format(self.last_name, self.first_name, self.middle_name)
user += '{}, {}, {}'.format(self.id_num, self.email, self.department.dept_info)
return user
def __str__(self):
return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name)
\ No newline at end of file
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