made the code cleaner by being able to display the info of Widget Users with less redundancy

parent e4a5b6bc
...@@ -4,12 +4,12 @@ from .models import Department, WidgetUser ...@@ -4,12 +4,12 @@ from .models import Department, WidgetUser
def dashboardIndex(request): def dashboardIndex(request):
users = WidgetUser.objects.all() users = WidgetUser.objects.all()
departments = Department.objects.all() departments = Department.objects.all()
dashboard_output = "Welcome to Widget!" + "<br>" + "<br>" + "WIDGET USERS:" + "<br>" + "<br>" dashboard_output = "Welcome to Widget! <br><br> WIDGET USERS: <br><br>"
for user in users: for user in users:
username = user.last_name + ", " + user.first_name + " " + user.middle_name + ": " username = str(user)
home_department = user.department.dept_name + ", " + user.department.home_unit home_department = str(user.department)
dashboard_output = dashboard_output + username + home_department + "<br>" dashboard_output = dashboard_output + username + ": " + home_department + "<br>"
......
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