Updated views.py content

parent f4bd9ae8
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from .models import Department, WidgetUser from .models import Department, WidgetUser
def index (request): def index (request):
dashboard_view = 'Welcome to Widget!<br> WIDGET USERS:<ul>' return_string = 'Welcome to Widget!<br> WIDGET USERS:<ul>'
department = Department.objects.all() for department in Department.objects.all():
widget_user = WidgetUser.objects.all() for user in WidgetUser.objects.all():
return_string += '<li>{}, {} {}: {}, {}</li>'.format(
for i in department: user.last_name, user.first_name, user.middle_name, user.department, department.home_unit
for user in widget_user: )
dashboard_view += '<li>{}, {} {}: {}, {}</li>'.format( return_string += '</ul>'
user.last_name, user.first_name, user.middle_name, user.department, i.home_unit) html_string = '<html><body>{}</body></html>'.format(return_string)
dashboard_view += '</ul>'
complete_view = '<html><body>{}</body></html>'.format(dashboard_view) return HttpResponse(html_string)
return HttpResponse(complete_view) \ No newline at end of file
\ 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