Commit f6998759 authored by Pierre Ashley Salcedo's avatar Pierre Ashley Salcedo

feat: update view of homepage app to display entries from WidgetUser model

parent f1f4d8d5
<!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.shortcuts import render
from django.http import HttpResponse from django.http import HttpResponse
from django.template import loader
from .models import WidgetUser
# Create your views here. # Create your views here.
def index(request): def index(request):
return HttpResponse("Welcome to Widget!") widget_users = WidgetUser.objects.all()
template = loader.get_template('homepage\index.html')
context = {
'widget_user_entries': widget_users
}
return HttpResponse(template.render(context, request))
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