Populated models and fixed formatting for Assigmments and Homepage

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