Commit 501fc377 authored by Pierre Ashley Salcedo's avatar Pierre Ashley Salcedo

Merge branch 'salcedo/homepage'

parents f99ce702 739ba144
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1> WIDGET USERS: </h1>
{% for widget_user in widget_user_entries %}
<p>
{{widget_user.last_name}},
{{widget_user.first_name}}
{{widget_user.middle_name}}:
{{widget_user.id_num}},
{{widget_user.email}},
{{widget_user.department.dept_name}}
{{widget_user.department.home_unit}}
</p>
{% endfor %}
</body>
</html>
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from .models import WidgetUser
# Create your views here.
def index(request):
widget_users = WidgetUser.objects.all()
template = loader.get_template('homepage\index.html')
context = {
'widget_user_entries': widget_users
}
html = "<html><body><h1>WIDGET USERS:</h1>"
for widget_user in widget_users:
html += "<p> {}, {} {}: {}, {}, {}, {} </p>".format(
widget_user.last_name,
widget_user.first_name,
widget_user.middle_name,
widget_user.id_num,
widget_user.email,
widget_user.department.dept_name,
widget_user.department.home_unit
)
html += "</body></html>"
return HttpResponse(template.render(context, request))
return HttpResponse(html)
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