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

fix: replaced use of template with html code inside views.py (i don't...

fix: replaced use of template with html code inside views.py (i don't understand templates, nor do i want to pretend that i do)
parent f6998759
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