Commit c939e1c1 authored by Stefan Gomez's avatar Stefan Gomez

Implemented the updated version of the main page of the 'Dashboard' app.

parent bac6df9e
from django.db import models from django.db import models
from django.urls import reverse
class Department(models.Model): class Department(models.Model):
...@@ -17,4 +18,6 @@ class WidgetUser(models.Model): ...@@ -17,4 +18,6 @@ class WidgetUser(models.Model):
def __str__(self): def __str__(self):
return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name) return '{}, {} {}'.format(self.last_name, self.first_name, self.middle_name)
def name_shortcut(self):
return '{}, {}'.format(self.last_name, self.first_name)
\ No newline at end of file
{% extends 'base.html' %}
{% block title %}Widget v2{% endblock %}
{% block content %}
<h1>Welcome to Widget!</h1>
<h1>Widget Users:</h1>
<h3>
{% for widgetuser in widgetusers %}
{{ widgetuser.name_shortcut }}<br>
{% endfor %}
</h3>
{% endblock %}
{% block scripts %}
<a href="/widgetusers/add"><input type="submit" value="Add Widget User"></a><br><br>
<a href="/announcement">Announcement Board</a><br>
<a href="/forum">Forum</a><br>
<a href="/assignments">Assignments</a><br>
<a href="/calendar">Calendar</a>
{% endblock %}
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse
from.models import Department, WidgetUser from.models import Department, WidgetUser
def index(request): def index(request):
page_content="""<H1>Welcome to Widget!</H1> return render(request, 'dashboard/dashboard.html', {'widgetusers': WidgetUser.objects.all()})
<li>WIDGET USERS:<br>"""
for user in WidgetUser.objects.all():
page_content += """<ul>
<li>{}, {} {}: {}<br>
</ul>""".format(user.last_name, user.first_name, user.middle_name, user.department)
return HttpResponse(page_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