Added full_name property to WidgetUser model and fixed syntax in homepage views

parent cee629ad
...@@ -20,8 +20,9 @@ class WidgetUser(models.Model): ...@@ -20,8 +20,9 @@ class WidgetUser(models.Model):
department = models.ForeignKey(Department, on_delete = models.CASCADE) department = models.ForeignKey(Department, on_delete = models.CASCADE)
@property @property
def user_info(self): def full_name(self):
user = '<br>{}, {} {}: '.format(self.last_name, self.first_name, self.middle_name) return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name)
user += '{}, {}, {}'.format(self.id_num, self.email, self.department.dept_info)
return user @property
\ No newline at end of file def user_info(self):
return '<br>{}: {}, {}, {}'.format(self.full_name, self.id_num, self.email, self.department.dept_info)
\ No newline at end of file
...@@ -13,7 +13,7 @@ def index(request): ...@@ -13,7 +13,7 @@ def index(request):
html = f''' html = f'''
<html> <html>
<body> <body>
<header><h1>WIDGET USERS:</h2><header> <header><h1>WIDGET USERS:</h1><header>
<main> <main>
<p>{user_list()}</p> <p>{user_list()}</p>
......
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