Updated and formatted view function

parent 19e5633b
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse
from .models import Department, WidgetUser
# Create your views here. def index (request):
dashboard_view = 'Welcome to Widget!<br> WIDGET USERS:<ul>'
department = Department.objects.all()
widget_user = WidgetUser.objects.all()
for i in department:
for user in widget_user:
dashboard_view += '<li>{}, {} {}: {}, {}</li>'.format(
user.last_name, user.first_name, user.middle_name, user.department, i.home_unit)
dashboard_view += '</ul>'
complete_view = '<html><body>{}</body></html>'.format(dashboard_view)
return HttpResponse(complete_view)
\ 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