Commit 7f4bd1d6 authored by Raul Jarod Conanan's avatar Raul Jarod Conanan

Merge branch 'dev' into 'master'

Dev

See merge request !25
parents 88b06797 0df29e8b
# Generated by Django 3.2 on 2023-05-13 20:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Department',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('dept_name', models.CharField(max_length=50)),
('home_unit', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='WidgetUser',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('first_name', models.CharField(max_length=50)),
('middle_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='department', to='Dashboard.department')),
],
),
]
{% extends 'base.html' %}
{% block title %} Widget v2 {% endblock %}
{% block header %} Welcome to Widget! {% endblock %}
{% block content %}
<div id = "object_container">
<h2>
Widget Users:
</h2>
<ul id = "object_list">
{% for user in users %}
<a href="/widgetusers/{{ user.pk }}/details/" class="item">{{ user.last_name }}, {{ user.first_name }}</a><br>
{% endfor %}
<br>
<li>
<a href="/widgetusers/add/" class="item">Add Widget User</a>
</li>
</ul>
</div>
{% endblock %}
{% block navbar %}
<div id = "navbar">
<a href="/announcements/">Announcement Board</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="/forum/">Forum</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/assignments/">Assignments</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/calendar/">Calendar</a>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %}
{% block title %} Add Widget User {% endblock %}
{% block header %} Add a new Widget user: {% endblock %}
{% block content %}
<form action="" method=POST>
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Add Widget User">
</form>
{% endblock %}
{% extends 'base.html' %}
{% block title %} {{ object.last_name }}, {{ object.first_name }} {% endblock %}
{% block header %} {{ object.first_name }} {{ object.middle_name }} {{ object.last_name }} {% endblock %}
{% block content %}
<p>
{{ object.department.dept_name }} <br>
{{ object.department.home_unit }} <br>
</p>
<li>
<a href = "/widgetusers/{{ object.pk }}/edit/" class="item">Edit Widget User</a>
</li>
{% endblock %}
{% extends 'base.html' %}
{% block title %} Edit Widget User {% endblock %}
{% block header %} Edit Widget User: {% endblock %}
{% block content %}
<form action="" method=POST>
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save Changes to Widget User">
</form>
{% endblock %}
...@@ -3,13 +3,10 @@ from .views import (Dashboard_list_view, WidgetUserDetailView, ...@@ -3,13 +3,10 @@ from .views import (Dashboard_list_view, WidgetUserDetailView,
WidgetUserAddView, WidgetUserUpdateView) WidgetUserAddView, WidgetUserUpdateView)
urlpatterns = [ urlpatterns = [
path('Dashboard/', Dashboard_list_view, name='Dashboard_list_view'), path('dashboard/', Dashboard_list_view, name='Dashboard_list_view'),
path('Widgetusers/<int:pk>/details', WidgetUserDetailView.as_view(), path('widgetusers/<int:pk>/details/', WidgetUserDetailView.as_view(), name='widgetuser-detail'),
name='widgetuser-detail'), path('widgetusers/add/', WidgetUserAddView.as_view(), name='widgetuser-add'),
path('Widgetusers/add/', WidgetUserAddView.as_view(), path('widgetusers/<int:pk>/edit/', WidgetUserUpdateView.as_view(), name='widgetuser-edit')
name='widgetuser-add'),
path('Widgetusers/<int:pk>/edit/', WidgetUserUpdateView.as_view(),
name='widgetuser-edit')
] ]
app_name = "Dashboard" app_name = "Dashboard"
from django.shortcuts import render
from .models import WidgetUser from .models import WidgetUser
from django.http import HttpResponse from django.http import HttpResponse
from django.views import generic from django.views import generic
...@@ -5,34 +6,18 @@ from django.urls import reverse ...@@ -5,34 +6,18 @@ from django.urls import reverse
def Dashboard_list_view(request): def Dashboard_list_view(request):
html_string_1 = '<html lang="en"><head><meta charset="UTF-8">' \ users = WidgetUser.objects.all()
'<h1>Welcome to Widget</h1>' \ context = {
'<h2>WIDGET USERS</h2></head><ul>' 'users': users
html_string_2 = '' }
for wu in WidgetUser.objects.all(): return render(request, 'dashboard/dashboard.html', context)
number = str(wu.pk)
href = '<a href="/Widgetusers/' + number + '/details">'
html_string_2 += '<li>' + href + '{}, {} {}: {}, {}' .format(
wu.last_name,
wu.first_name,
wu.middle_name,
wu.department.dept_name,
wu.department.home_unit
)
html_string_2 += '</ul></li>'
html_string_3 = '<a href="/Widgetusers/add"><button value="click here" > Add Widget User</button></a><br><br>'
html_string_3 += '<a href="/announcements/">Announcement Board</a><br>'
html_string_3 += '<a href="/forum/">Forum</a><br>'
html_string_3 += '<a href="/assignments">Assignment</a><br>'
html_string_3 += '<a href="/widget_Calendar/">Calendar</a><br>'
html_string_final = html_string_1 + html_string_2 + html_string_3 + '</html>'
return HttpResponse(html_string_final)
class WidgetUserDetailView(generic.DetailView): class WidgetUserDetailView(generic.DetailView):
model = WidgetUser model = WidgetUser
template_name = 'widgetuser-details.html' template_name = 'dashboard/widgetuser-details.html'
queryset = WidgetUser.objects.all() queryset = WidgetUser.objects.all()
context_object_name = 'widgetuser-detail' context_object_name = 'widgetuser-detail'
...@@ -40,7 +25,7 @@ class WidgetUserDetailView(generic.DetailView): ...@@ -40,7 +25,7 @@ class WidgetUserDetailView(generic.DetailView):
class WidgetUserAddView(generic.CreateView): class WidgetUserAddView(generic.CreateView):
model = WidgetUser model = WidgetUser
fields = '__all__' fields = '__all__'
template_name = 'widgetuser-add.html' template_name = 'dashboard/widgetuser-add.html'
def get_success_url(self): def get_success_url(self):
return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id}, return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id},
...@@ -49,9 +34,9 @@ class WidgetUserAddView(generic.CreateView): ...@@ -49,9 +34,9 @@ class WidgetUserAddView(generic.CreateView):
class WidgetUserUpdateView(generic.UpdateView): class WidgetUserUpdateView(generic.UpdateView):
model = WidgetUser model = WidgetUser
template_name = 'widgetuser-edit.html' template_name = 'dashboard/widgetuser-edit.html'
fields = '__all__' fields = '__all__'
success_url = "Dashboard/" success_url = "dashboard/"
def get_success_url(self): def get_success_url(self):
return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id}, return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id},
......
# Generated by Django 3.2 on 2023-05-13 20:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('Dashboard', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Announcement',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.TextField(blank=True, null=True)),
('body', models.TextField(blank=True, null=True)),
('pub_datetime', models.DateTimeField(null=True)),
('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='Dashboard.widgetuser')),
],
),
migrations.CreateModel(
name='Reaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, default='Like', max_length=5, null=True)),
('tally', models.IntegerField(blank=True, default=0, null=True)),
('announcement', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='react', to='announcements.announcement')),
],
),
]
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %}
{% block content %} {% block title %} Add Announcement {% endblock %}
{% block header %} Add a new announcement: {% endblock %}
<title>Add Announcement</title> {% block content %}
<h1>Add a new announcement:</h1>
<form action="" method=POST> <form action="" method=POST>
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Add Announcement"> <input type="submit" value="Add Announcement">
</form> </form>
{% endblock %}
{% endblock content %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %}
{% block content %} {% block title %} {{ announce.title }} {% endblock %}
<title>{{ announce.title }}</title> {% block header %} {{ announce.title }} {% endblock %}
<h1>{{ announce.title }}</h1> {% block content %}
<h2>by {{ announce.author.first_name }} {{ announce.author.last_name }}</h2> <h2>by {{ announce.author.first_name }} {{ announce.author.last_name }}</h2>
<p>{{ announce.pub_datetime|date:'m/d/Y, h:i A' }}</p> <p>{{ announce.pub_datetime|date:'m/d/Y, h:i A' }}</p>
<p>{{ announce.body }}</p> <p>{{ announce.body }}</p>
<p>
{% for react in announce.react.all %} {% for react in announce.react.all %}
{{ react.name }}: {{ react.tally }}<br> {{ react.name }}: {{ react.tally }}<br>
{% endfor %} {% endfor %}
</p> <li>
<a href = "/announcements/{{ announce.pk }}/edit/" class="item">Edit Announcement</a>
<a href = "/announcements/{{ announce.pk }}/edit/"><button value="">Edit Announcement</button></a> </li>
{% endblock content %} {% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %}
{% block content %} {% block title %} Edit Announcement {% endblock %}
{% block header %} Edit announcement: {% endblock %}
<title>Edit Announcement</title> {% block content %}
<h1>Edit announcement:</h1>
<form action="" method=POST> <form action="" method=POST>
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Save Changes to Announcement"> <input type="submit" value="Save Changes to Announcement">
</form> </form>
{% endblock %}
{% endblock content %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %}
{% block content %} {% block title %} Widget's Announcement Board {% endblock %}
<title>Widget's Announcement Board</title>
<h1>Welcome to Widget's Announcement Board!</h1>
<h3>Announcements:</h3> {% block header %} Welcome to Widget's Announcement Board! {% endblock %}
{% for announce in announcement %}
<a href = "{{ announce.pk }}/details/">{{ announce.title }} by {{ announce.author.first_name }} {{ announce.author.last_name }}</a><br>
{% endfor %} <br>
<a href="add/"><button value="click here">Add Announcement</button></a><br><br>
<a href = "/Dashboard/">Dashboard</a><br> {% block content %}
<a href = "/forum/">Forum</a><br> <div id = "object_container">
<a href = "/assignments/">Assignments</a><br> <ul id = "object_list">
<a href = "/widget_Calendar/">Calendar</a> {% for announce in announcement %}
<a href = "{{ announce.pk }}/details/" class = "item">{{ announce.title }} by {{ announce.author.first_name }} {{ announce.author.last_name }}</a> <br>
{% endfor %}
<li>
<a href="add/" class="item">Add Announcement</a>
</li>
</ul>
</div>
{% endblock %}
{% endblock content %} {% block navbar %}
\ No newline at end of file <div id = "navbar">
<a href = "/dashboard/">Dashboard</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/forum/">Forum</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/assignments/">Assignments</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/calendar/">Calendar</a>
</div>
{% endblock %}
\ No newline at end of file
# Generated by Django 3.2 on 2023-05-13 20:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Course',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('code', models.CharField(blank=True, max_length=10, null=True)),
('title', models.CharField(blank=True, max_length=255, null=True)),
('section', models.CharField(blank=True, max_length=3, null=True)),
],
),
migrations.CreateModel(
name='Assignment',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(blank=True, max_length=255, null=True)),
('description', models.TextField(blank=True, null=True)),
('perfect_score', models.IntegerField(blank=True, null=True)),
('passing_score', models.IntegerField(blank=True, null=True)),
('course', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='assignments.course')),
],
),
]
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block title %} Add Assignment {% endblock %}
<title>Add Assignment</title>
<h1>Add a new assignment:</h1> {% block header %} Add a new assignment: {% endblock %}
{% block content %}
<form action="" method=POST> <form action="" method=POST>
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Save New Assignment"> <input type="submit" value="Save New Assignment">
</form> </form>
{% endblock content %} {% endblock %}
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block title %} {{ assignment.name }} {% endblock %}
<title>{{ assignment.name }}</title>
<h1>{{ assignment.name }}</h1> {% block header %} {{ assignment.name }} {% endblock %}
{% block content %}
<p> <p>
{{ assignment.course.code }} {{ assignment.course.title }}-{{ assignment.course.section }} <br><br> {{ assignment.course.code }} {{ assignment.course.title }}-{{ assignment.course.section }} <br><br>
Description: {{ assignment.description }} <br> Description: {{ assignment.description }} <br>
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
Passing Score: {{ assignment.passing_score }} <br> Passing Score: {{ assignment.passing_score }} <br>
</p> </p>
<li> <li>
<a href="{{ assignment.get_update_url }}">Edit Assignment</a> <a href="{{ assignment.get_update_url }}" class="item">Edit Assignment</a>
</li> </li>
{% endblock %} {% endblock %}
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block title %} Edit Assignment {% endblock %}
<title>Edit Assignment</title>
<h1>Edit Assignment.</h1> {% block header %} Edit Assignment: {% endblock %}
{% block content %}
<form action="" method=POST> <form action="" method=POST>
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Save Changes to Assignment"> <input type="submit" value="Save Changes to Assignment">
</form> </form>
{% endblock content %} {% endblock %}
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block title %} Widget's Assignments {% endblock %}
<title>Widget's Assignments</title>
<h1>Welcome to Widget's Assignments!</h1>
{% for assignment in assignments %} {% block header %} Welcome to Widget's Assignments! {% endblock %}
<a href="{{ assignment.pk }}/details/">{{ assignment.name }}</a><br>
{% endfor %}
<br> {% block content %}
<div id = "object_container">
<a href="add/"><button value="click here">New Assignment</button></a><br><br> <ul id = "object_list">
{% for assignment in assignments %}
<a href="{{ assignment.pk }}/details/" class="item">{{ assignment.name }}</a><br>
{% endfor %}
<br>
<li>
<a href="add/" class="item">New Assignment</a>
</li>
</ul>
</div>
{% endblock %}
<a href="/Dashboard/">Dashboard</a><br> {% block navbar %}
<a href="/announcements/">Announcements</a><br> <div id = "navbar">
<a href="/forum/">Forum</a><br> <a href = "/dashboard/">Dashboard</a>
<a href="/widget_Calendar/">Calendar</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% endblock content %} <a href="/announcements/">Announcements</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/forum/">Forum</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/calendar/">Calendar</a>
</div>
{% endblock %}
\ No newline at end of file
# Generated by Django 3.2 on 2023-05-13 20:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('Dashboard', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ForumPost',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(blank=True, max_length=255, null=True)),
('body', models.TextField(blank=True, null=True)),
('pub_datetime', models.DateTimeField(auto_now_add=True)),
('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='forumpost', to='Dashboard.widgetuser')),
],
),
migrations.CreateModel(
name='Reply',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('body', models.TextField(blank=True, null=True)),
('pub_datetime', models.DateTimeField(auto_now_add=True)),
('author', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='Dashboard.widgetuser')),
('forum_post', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reply', to='forum.forumpost')),
],
),
]
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% block title %} Widget's Forum {% endblock %}
{% block content %} {% block header %} Welcome to Widget's Forum {% endblock %}
<title>Widget's Forum</title>
<h1>Welcome to Widget's Forum</h1>
<h2>Forum posts:</h2>
{% for post in posts %}
<a href="forumposts/{{ post.pk }}/details/">{{ post.title }} by {{ post.author.first_name }} {{ post.author.last_name }}</a><br>
{% endfor %}
<br><br>
<a href="forumposts/add/"><button value="click here">New Post</button></a><br><br> {% block content %}
<div id = "object_container">
<ul id = "object_list">
{% for post in posts %}
<a href="forumposts/{{ post.pk }}/details/" class="item">{{ post.title }} by {{ post.author.first_name }} {{ post.author.last_name }}</a><br>
{% endfor %}
<br>
<li>
<a href="forumposts/add/" class="item">New Post</a>
</li>
</ul>
</div>
{% endblock %}
<a href="/Dashboard/">Dashboard</a><br> {% block navbar %}
<a href="/announcements/">Announcements</a><br> <div id = "navbar">
<a href="/assignments/">Assignments</a><br> <a href = "/dashboard/">Dashboard</a>
<a href="/widget_Calendar/">Calendar</a><br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{% endblock content %} <a href="/announcements/">Announcements</a>
\ No newline at end of file &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/assignments/">Assignments</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/calendar/">Calendar</a>
</div>
{% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% block title %} Add Post {% endblock %}
{% block header %} Add a new post: {% endblock %}
{% block content %} {% block content %}
<title>Add Post</title> <form action="" method=POST>
<h1>Add a new post:</h1> {% csrf_token %}
<form method="post">
{% csrf_token %} {{ form.as_p }}
{{ form.as_p }}
<input type="submit" value="Save New Post"> <input type="submit" value="Save New Post">
</form> </form>
{% endblock content %} {% endblock %}
\ No newline at end of file
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% block title %} {{ posts.title }} {% endblock %}
{% block header %} {{ posts.title }} {% endblock %}
{% block content %} {% block content %}
<title>{{ posts.title }}</title>
<h1>{{ posts.title }}</h1>
<h2>by {{ posts.author.first_name }} {{ posts.author.last_name }}</h2> <h2>by {{ posts.author.first_name }} {{ posts.author.last_name }}</h2>
<p>{{ posts.pub_datetime|date:"M/d/Y, f A"}}</p> <p>{{ posts.pub_datetime|date:"M/d/Y, f A"}}</p>
<p>{{ posts.body }}</p> <p>{{ posts.body }}</p>
...@@ -14,5 +14,7 @@ ...@@ -14,5 +14,7 @@
{{ reply.pub_datetime|date:"M/d/Y, f A"}}<br> {{ reply.pub_datetime|date:"M/d/Y, f A"}}<br>
{{ reply.body }}<br><br> {{ reply.body }}<br><br>
{% endfor %} {% endfor %}
<a href="/forum/forumposts/{{ posts.pk }}/edit/"><button value="click here">Edit Post</button></a> <li>
{% endblock content %} <a href="/forum/forumposts/{{ posts.pk }}/edit/" class="item">Edit Post</a>
\ No newline at end of file </li>
{% endblock %}
{% extends 'base.html' %} {% extends 'base.html' %}
{% load static %} {% block title %} Edit Post {% endblock %}
{% block header %} Edit post: {% endblock %}
{% block content %} {% block content %}
<title>Edit Post</title> <form action="" method=POST>
<h1>Edit post:</h1> {% csrf_token %}
<form method="post">
{% csrf_token %} {{ form.as_p }}
{{ form.as_p }}
<input type="submit" value="Save Changes to Post"> <input type="submit" value="Save Changes to Post">
</form> </form>
{% endblock content %} {% endblock %}
\ No newline at end of file
body {
font-family: Arial;
line-height: 20px;
}
div {
margin: auto;
width: 50%;
padding: 10px;
line-height: 26px;
}
#main {
padding: 10px;
background-color: #ffffff;
font: 80% Verdana;
}
h1 {
text-align: center;
color: #000000;
}
#content {
}
#object_list {
text-align: center;
padding: 0;
font: 16px verdana;
}
#navbar {
background-color: #000000;
border: 1px solid #000000;
text-align: center;
margin: auto;
border-radius: 10px;
}
#navbar > a {
color: #ffffff;
}
#object_container {
}
li {
width: 255px;
background-color: #ffffff;
border: 1px solid #000000;
border-radius: 10px;
color: #000000;
list-style-type: none;
margin: 12px;
padding: 7px;
text-align: center;
cursor: pointer;
}
li:hover, li:hover .item {
background-color: #000000;
font-weight: bold;
color: #ffffff;
text-decoration: underline;
}
a {
color: #000000;
text-decoration: none;
}
a:hover {
text-decoration: underline;
color: #000000;
}
<!DOCTYPE html> <!DOCTYPE html>
<html> {% load static %}
<body> <html lang="en">
<link rel="stylesheet" href="{% static 'styles.css' %}">
<head>
{% block content %} <title> {% block title %} Title {% endblock %}</title>
{% endblock content %}<br> </head>
<div id = "main">
<body>
<h1>
{% block header %} Header {% endblock %}
</h1>
<div id = "content">
{% block content %} Content {% endblock %}
</body> </div>
{% block navbar %} {% endblock %}
</body>
</div>
</html> </html>
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>Add Widget User</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<a href="/Widgetusers/{{WidgetUser.pk}}/details">
<button type="submit">Add Widget User</button>
</a>
</form>
{% endblock content %}
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block content %}
<title> Widget User</title>
<br><br>
<h2>{{object.first_name}} {{object.middle_name}} {{object.last_name}}</h2>
<h3>{{object.department}}</h3>
<h3>{{object.department.home_unit}}</h3>
<a href="/Widgetusers/{{ object.id }}/edit">
<input type="button" value="Edit Widget User">
</a>"
{% endblock content %}
\ No newline at end of file
{% extends "base.html" %}
{% load static %}
{% block content %}
<h1>Edit Widget User</h1>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Edit Widget User" />
</a>
</form>
{% endblock content %}
\ No newline at end of file
# Generated by Django 3.2 on 2023-05-13 20:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('assignments', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Location',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('mode', models.CharField(choices=[('onsite', 'Onsite'), ('online', 'Online'), ('hybrid', 'Hybrid')], max_length=6)),
('venue', models.CharField(max_length=100)),
],
),
migrations.CreateModel(
name='Event',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('activity', models.CharField(max_length=100)),
('target_datetime', models.DateTimeField()),
('estimated_hours', models.FloatField()),
('course', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='event', to='assignments.course')),
('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='widget_Calendar.location')),
],
),
]
{% extends 'base.html' %}
{% block title %} Widget's Calendar of Activities {% endblock %}
{% block header %} Widget's Calendar of Activities {% endblock %}
{% block content %}
<div id = "object_container">
<ul id = "object_list">
{% for event in events %}
<a href="events/{{ event.pk }}/details/" class="item">{{ event.activity }}</a><br>
{% endfor %}
<br>
<li>
<a href="events/add/" class="item">New Activity</a>
</li>
</ul>
</div>
{% endblock %}
{% block navbar %}
<div id = "navbar">
<a href = "/dashboard/">Dashboard</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="/announcements/">Announcements</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/forum/">Forum</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href = "/assignments/">Assignments</a>
</div>
{% endblock %}
{% extends "base.html" %} {% extends 'base.html' %}
{% load static %} {% block title %} Add Activity {% endblock %}
{% block content %} {% block header %} Add a new activity: {% endblock %}
<title>Add Activity</title>
Add a new activity:
<form method="post">
{% csrf_token %}
{{ form.as_p }}
{% block content %}
<form action="" method=POST>
{% csrf_token %}
<a href="/Events/{{Event.pk}}/details"> {{ form.as_p }}
<button type="submit">Save New Activity</button>
</a>
</form> <input type="submit" value="Save New Assignment">
{% endblock content %} </form>
\ No newline at end of file {% endblock %}
{% extends "base.html" %} {% extends 'base.html' %}
{% load static %} {% block title %} {{ object.name }} {% endblock %}
{% block content %} {% block header %} {{ object.name }} {% endblock %}
<title>{{object.activity}}</title>
<h2>{{object.activity}}</h2>
<br>Date and Time: {{object.target_datetime|date:"m/d/y, h:i A"}}<br>
<br>Estimated Hours: {{object.estimated_hours}}<br>
<br>{{object.course.code}} {{object.course.title}} - {{object.course.section}}<br>
<br>Mode: {{object.location.mode}}<br>
<br>Venue: {{object.location.venue}}<br>
<br><br> {% block content %}
<a href="edit"> <h2>{{object.activity}}</h2>
<input type="button" value="Edit Activity"> <p>
</a> Date and Time: {{object.target_datetime|date:"m/d/y, h:i A"}} <br>
{% endblock content %} Estimated Hours: {{object.estimated_hours}} <br>
\ No newline at end of file {{object.course.code}} {{object.course.title}} - {{object.course.section}} <br>
Mode: {{object.location.mode}} <br>
Venue: {{object.location.venue}} <br>
</p>
<li>
<a href = "/calendar/events/{{ object.pk }}/edit/" class="item">Edit Activity</a>
</li>
{% endblock %}
{% extends "base.html" %} {% extends 'base.html' %}
{% load static %} {% block title %} Edit Activity {% endblock %}
{% block content %} {% block header %} Edit Activity: {% endblock %}
<title>Edit Activity</title>
Edit Activity:<br> {% block content %}
<form action="" method=POST>
{% csrf_token %}
<form method="post"> {{ form.as_p }}
{% csrf_token %}
{{ form.as_p }}
<input type="submit" value="Save New Activity" /> <input type="submit" value="Save New Activity">
</a> </form>
</form> {% endblock %}
{% endblock content %}
\ No newline at end of file
...@@ -4,11 +4,11 @@ from .views import (index, EventDetailView, EventAddView, EventUpdateView) ...@@ -4,11 +4,11 @@ from .views import (index, EventDetailView, EventAddView, EventUpdateView)
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
path('widget_Calendar/Events/<int:pk>/details', EventDetailView.as_view(), path('events/<int:pk>/details/', EventDetailView.as_view(),
name='event-detail'), name='event-detail'),
path('widget_Calendar/Events/add/', EventAddView.as_view(), path('events/add/', EventAddView.as_view(),
name='event-add'), name='event-add'),
path('widget_Calendar/Events/<int:pk>/edit/', EventUpdateView.as_view(), path('events/<int:pk>/edit/', EventUpdateView.as_view(),
name='event-edit') name='event-edit')
] ]
......
from django.shortcuts import render
from .models import Event from .models import Event
from django.http import HttpResponse from django.http import HttpResponse
from forum.views import convert_utc_to_local from forum.views import convert_utc_to_local
...@@ -6,40 +7,11 @@ from django.urls import reverse ...@@ -6,40 +7,11 @@ from django.urls import reverse
def index(request): def index(request):
html_string = ''' events = Event.objects.all()
<title>robo_mommy’s Calendar of Activities</title> context = {
<h2>robo_mommy’s Calendar of Activities</h2><ul> 'events': events
''' }
for eventItem in Event.objects.all(): return render(request, 'widget_Calendar/calendar.html', context)
eventId = str(eventItem.pk)
href = '<a href="widget_Calendar/Events/'+eventId+'/details">'
html_string += '''
<br><li> {}
Date and Time: {}<br>
Activity: {}<br>
Estimated Hours: {}<br>
Course/Section: {}<br>
Mode: {}<br>
Venue: {}<br>
</li><br>
'''.format(
href,
convert_utc_to_local(eventItem.target_datetime, '%d/%m/%Y|%I:%M %p'),
eventItem.activity,
eventItem.estimated_hours,
eventItem.course.code,
eventItem.location.mode,
eventItem.location.venue,
)
html_string += '''
</ul>
<a href="widget_Calendar/Events/add"><button value="click here">New Activity</button></a><br><br>
<a href="/Dashboard/">Dashboard</a><br>
<a href="/announcements/">Announcements</a><br>
<a href="/forum/">Forum</a><br>
<a href="/assignments">Assignments</a><br>
'''
return HttpResponse(html_string)
class EventDetailView(generic.DetailView): class EventDetailView(generic.DetailView):
......
...@@ -130,7 +130,8 @@ USE_TZ = True ...@@ -130,7 +130,8 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.2/howto/static-files/ # https://docs.djangoproject.com/en/3.2/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = 'static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
# Default primary key field type # Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field
......
...@@ -19,10 +19,10 @@ from django.urls import include, path ...@@ -19,10 +19,10 @@ from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('', include('announcements.urls', namespace="announcements")), path('', include('announcements.urls', namespace="announcements")),
path('widget_Calendar/', include('widget_Calendar.urls', namespace="widget_Calendar")), path('calendar/', include('widget_Calendar.urls', namespace="widget_Calendar")),
path('', include('Dashboard.urls', namespace="Dashboard")), path('', include('Dashboard.urls', namespace="dashboard")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
path('assignments/', include('assignments.urls', namespace="assignments")), path('assignments/', include('assignments.urls', namespace="assignments")),
path('', include(('forum.urls', 'forum'), namespace='forum')), path('', include(('forum.urls', 'forum'), namespace='forum')),
# path('Dashboard/', include('Dashboard.urls', namespace="Dashboard")), # path('dashboard/', include('dashboard.urls', namespace="dashboard")),
] ]
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