Commit bc58a526 authored by justin's avatar justin

feat: shifted to using HTML templates for dashboard view

parent 7537a392
{% extends 'base.html' %}
{% block content %}
<h1>Welcome to Widget!</h1>
<h2>Widget Users:</h2>
<ul>
{% for user in users %}
<a href="">
<li>{{ user.last_name }}, {{ user.first_name }}</li>
</a>
{% endfor %}
</ul>
{% endblock %}
from django.http import HttpResponse # from django.http import HttpResponse
from .models import Department, WidgetUser from .models import WidgetUser
from django.shortcuts import render
def dashboard(request): def dashboard(request):
content = "Welcome to Widget! <br><br> WIDGET USERS: <br>" # content = "Welcome to Widget! <br><br> WIDGET USERS: <br>"
# users = WidgetUser.objects.all()
#
# for user in users:
# content += str(user) + ": " + str(user.department) + "<br>"
#
# return HttpResponse(content)
users = WidgetUser.objects.all() users = WidgetUser.objects.all()
context = {"users": users}
for user in users: return render(request, "dashboard/dashboard.html", context)
content += str(user) + ": " + str(user.department) + "<br>"
return HttpResponse(content)
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