Commit e94f2504 authored by John Tamano's avatar John Tamano

Fixed views to display model data using HttpResponse only. Removed Template format.

parent 6d8d23a3
from tkinter import Widget
from django.shortcuts import render
from django.template.loader import get_template
from homepage.models import Department, WidgetUser
......@@ -11,9 +12,23 @@ def index(request):
def displayWidgetUsers(request):
WidgetUsers = models.WidgetUser.objects.all()
WidgetUserInfo = ""
for i in WidgetUsers:
last_name = i.last_name
middle_name = i.middle_name
first_name = i.first_name
id_number = i.id_num
email = i.email
dept = str(i.department)
home_unit = i.department.home_unit
temp = last_name + ", " + first_name + " " + middle_name + ": " + id_number + ", " + email + ", " + dept + ", " + home_unit
WidgetUserInfo += "<br>" + temp
return HttpResponse("WIDGET USERS:\n" + WidgetUserInfo)
'''
WidgetUserTemplate = get_template('homepage.html')
display = WidgetUserTemplate.render({'displayWidgetUsers': WidgetUsers})
return HttpResponse(display)
'''
# Create your views here.
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