Commit 8b56b8e8 authored by Mavrick Jordan Lee's avatar Mavrick Jordan Lee

Added view and template for dashboard. Updated urls for project and app level.

parent f7b9c051
{% extends 'base.html' %}
{% block title %}Widget v2{% endblock %}
{% block content %}
<h1>Welcome to Widget!</h1>
<h2>Widget Users:</h2>
{% for user in widget_users %}
{{user.last_name}}, {{user.first_name}}<br>
{% endfor %}
<br><button>Add Widget User</button><br><br>
Announcement Board <br>
Forum <br>
{% endblock %}
\ No newline at end of file
...@@ -3,5 +3,5 @@ from django.urls import path ...@@ -3,5 +3,5 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path('', views.dashboard, name = "dashboard"), path('dashboard/', views.dashboard, name = "dashboard"),
] ]
\ No newline at end of file
from django.http import HttpResponse
from .models import Department, WidgetUser from .models import Department, WidgetUser
from django.shortcuts import render
# Create your views here. # Create your views here.
def dashboard(request): def dashboard(request):
widget_users = WidgetUser.objects.all() widget_users = WidgetUser.objects.all()
response = "Welcome to Widget!<br><br>" + "WIDGET USERS:<br>" context = {"widget_users": widget_users}
for user in widget_users: return render(request, 'dashboard/dashboard.html', context)
name = user.last_name + ", " + user.first_name + " " + user.middle_name + ": " \ No newline at end of file
response += name + user.user_department.dept_name + ", " + user.user_department.home_unit + "<br>"
return HttpResponse(response)
\ No newline at end of file
...@@ -17,7 +17,7 @@ from django.contrib import admin ...@@ -17,7 +17,7 @@ from django.contrib import admin
from django.urls import path, include from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('dashboard/', include("dashboard.urls")), path('', include("dashboard.urls")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('announcements/', include("announcements.urls")), path('announcements/', include("announcements.urls")),
path('forum/', include("forum.urls")) path('forum/', include("forum.urls"))
......
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