Commit 905e949a authored by Mavrick Jordan Lee's avatar Mavrick Jordan Lee

Added Sample Data for Dashboard Models. Created views.py for Dashboard.

parent 7f2347d0
from django.urls import path
from . import views
urlpatterns = [
path('', views.dashboard, name = "dashboard"),
]
\ No newline at end of file
from django.shortcuts import render from django.http import HttpResponse
from .models import Department, WidgetUser
# Create your views here. # Create your views here.
def dashboard(request):
departments = Department.objects.all()
widget_users = WidgetUser.objects.all()
response = "Welcome to Widget!<br><br>" + "WIDGET USERS:<br>"
for user in widget_users:
name = user.last_name + ", " + user.first_name + " " + user.middle_name + ": "
response += name + user.user_department.dept_name + ", " + user.user_department.home_unit + "<br>"
return HttpResponse(response)
\ No newline at end of file
...@@ -14,8 +14,9 @@ Including another URLconf ...@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path from django.urls import path, include
urlpatterns = [ urlpatterns = [
path('dashboard/', include("dashboard.urls")),
path('admin/', admin.site.urls), path('admin/', admin.site.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