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
def dashboardIndex(request):
users = WidgetUser.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:
username = user.last_name + ", " + user.first_name + " " + user.middle_name + ": "
home_department = user.department.dept_name + ", " + user.department.home_unit
dashboard_output = dashboard_output + username + home_department + "<br>"
username = str(user)
home_department = str(user.department)
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