Commit 6130be80 authored by justin's avatar justin

Merge branch 'dashboard_wip'

parents fd90c34d f795d2e2
from django.db import models
# Create your models here.
class Department(models.Model):
dept_name = models.CharField(max_length=255)
home_unit = models.CharField(max_length=255)
def __str__(self):
return f"{self.dept_name}, {self.home_unit}"
class WidgetUser(models.Model):
first_name = models.CharField(max_length=255)
middle_name = models.CharField(max_length=255)
last_name = models.CharField(max_length=255)
department = models.ForeignKey(
Department,
on_delete=models.CASCADE,
)
def __str__(self):
return f"{self.last_name}, {self.first_name} {self.middle_name}"
def displayName(self):
return f"{self.first_name} {self.last_name}"
from django.urls import path
from . import views
urlpatterns = [
path("", views.dashboard, name="dashboard"),
]
from django.shortcuts import render
from django.http import HttpResponse
from .models import Department, WidgetUser
# Create your views here.
def dashboard(request):
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)
......@@ -14,8 +14,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path("admin/", admin.site.urls),
path("dashboard/", include("dashboard.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