Commit d14eed18 authored by RJC's avatar RJC

Merge branch 'dev' of https://gitlab.discs.ateneo.edu/RJC/midterm_robo_mommy into 1-Forum

 Conflicts:
	widget_robo_mommy/forum/views.py
parents 6a21c46c 2c7982d5
...@@ -3,6 +3,7 @@ CSCI 40 - E SOFTWARE TOOLS AND DEVELOPMENT FRAMEWORKS ...@@ -3,6 +3,7 @@ CSCI 40 - E SOFTWARE TOOLS AND DEVELOPMENT FRAMEWORKS
MEMBERS: MEMBERS:
Bomediano, Al Vincent E. 210924 Bomediano, Al Vincent E. 210924
Conanan, Raul Jarod C. 211591 Conanan, Raul Jarod C. 211591
Hu, Jiuvi Anne Marie Chrystine D. 202539
Hung, Cheska Elise O. 202550 Hung, Cheska Elise O. 202550
Santuyo, Lance Dominic B. 215335 Santuyo, Lance Dominic B. 215335
...@@ -17,10 +18,21 @@ Forum - RJ ...@@ -17,10 +18,21 @@ Forum - RJ
Assignments - LANCE Assignments - LANCE
Calendar - AL Calendar - AL
DATE_OF_SUBMISSION: **/**/** DATE_OF_SUBMISSION: 06/03/2023
GROUP_STATEMENT: GROUP_STATEMENT:
We do solemnly swear that everything here was completely and totally hontou ni done by us.
REFERENCES: REFERENCES:
https://stackoverflow.com/questions/26812805/django-convert-utc-to-local-time-zone-in-views
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Home_page
https://docs.djangoproject.com/en/4.1/
SIGNATURES: SIGNATURES:
(sgd) Bomediano, Al Vincent E. 06/03/2023
(sgd) Conanan, Raul Jarod C. 06/03/2023
(sgd) Hu, Jiuvi Anne Marie Chrystine D. 06/03/2023
(sgd) Hung, Cheska Elise O. 06/03/2023
(sgd) Santuyo, Lance Dominic B. 06/03/2023
from django.contrib import admin
from .models import Assignment, Course
class AssignmentAdmin(admin.ModelAdmin):
model = Assignment
class CourseAdmin(admin.ModelAdmin):
model = Course
admin.site.register(Assignment, AssignmentAdmin)
admin.site.register(Course, CourseAdmin)
from django.apps import AppConfig
class AssignmentsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'Assignments'
# Generated by Django 4.1.7 on 2023-03-04 17:11
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
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)),
('course', models.CharField(blank=True, max_length=255, null=True)),
('perfect_score', models.IntegerField(blank=True, null=True)),
('passing_score', models.IntegerField(blank=True, null=True)),
],
),
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)),
],
),
]
# Generated by Django 4.1.7 on 2023-03-04 17:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Assignments', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='course',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='Assignments.course'),
),
]
from django.db import models
class Course(models.Model):
code = models.CharField(max_length=10, blank=True, null=True)
title = models.CharField(max_length=255, blank=True, null=True)
section = models.CharField(max_length=3, blank=True, null=True)
class Assignment(models.Model):
name = models.CharField(max_length=255, blank=True, null=True)
description = models.TextField(blank=True, null=True)
course = models.ForeignKey(Course, on_delete=models.CASCADE, null=True)
perfect_score = models.IntegerField(blank=True, null=True)
passing_score = models.IntegerField(blank=True, null=True)
def save(self, *args, **kwargs):
self.passing_score = int(self.perfect_score * 0.60)
super(Assignment, self).save(*args, **kwargs)
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "Assignments"
from django.http import HttpResponse
from .models import Assignment
def index(request):
output = f"Widget's Assignments Page<br><br>"
count = Assignment.objects.all().count()
for i in range(1, count + 1):
assignments = Assignment.objects.get(id=i)
output += f"""Assignment Name: {assignments.name}<br>
Description: {assignments.description}<br>
Perfect Score: {assignments.perfect_score}<br>
Passing Score: {assignments.passing_score}<br>
Course/Section: {assignments.course.code} {assignments.course.title}-{assignments.course.section}<br>
<br>"""
return HttpResponse(output)
from django.contrib import admin from django.contrib import admin
from .models import Department from .models import Department, WidgetUser
class DepartmentAdmin(admin.ModelAdmin): class DepartmentAdmin(admin.ModelAdmin):
...@@ -11,4 +11,9 @@ class DepartmentAdmin(admin.ModelAdmin): ...@@ -11,4 +11,9 @@ class DepartmentAdmin(admin.ModelAdmin):
search_fields = ('dept_name', 'home_unit') search_fields = ('dept_name', 'home_unit')
class WidgetUserAdmin(admin.ModelAdmin):
model = WidgetUser
admin.site.register(Department, DepartmentAdmin) admin.site.register(Department, DepartmentAdmin)
admin.site.register(WidgetUser, WidgetUserAdmin)
# Generated by Django 3.2 on 2023-03-04 15:37 # Generated by Django 4.1.6 on 2023-03-04 16:34
import django.contrib.auth.models
from django.db import migrations, models from django.db import migrations, models
import django.db.models.deletion import django.db.models.deletion
...@@ -8,7 +7,6 @@ import django.db.models.deletion ...@@ -8,7 +7,6 @@ import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
('Dashboard', '0001_initial'), ('Dashboard', '0001_initial'),
] ]
...@@ -16,16 +14,11 @@ class Migration(migrations.Migration): ...@@ -16,16 +14,11 @@ class Migration(migrations.Migration):
migrations.CreateModel( migrations.CreateModel(
name='WidgetUser', name='WidgetUser',
fields=[ fields=[
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='auth.user')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
], ('first_name', models.CharField(max_length=50)),
options={ ('middle_name', models.CharField(max_length=50)),
'verbose_name': 'user', ('last_name', models.CharField(max_length=50)),
'verbose_name_plural': 'users', ('department', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Dashboard.department')),
'abstract': False,
},
bases=('auth.user',),
managers=[
('objects', django.contrib.auth.models.UserManager()),
], ],
), ),
] ]
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.urls import reverse
class Department(models.Model): class Department(models.Model):
dept_name = models.CharField(max_length=50) dept_name = models.CharField(max_length=50)
home_unit = models.CharField(max_length=100) home_unit = models.CharField(max_length=100)
class WidgetUser(User): def __str__(self) -> str:
pass return str(self.dept_name)
class WidgetUser(models.Model):
first_name = models.CharField(max_length=50)
middle_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
department = models.ForeignKey(Department, related_name="department", on_delete=models.CASCADE)
def get_absolute_url(self):
return reverse('widgetuser-detail', kwargs={'pk': self.pk})
def get_absolute_url(self):
return reverse('widgetuser-add', kwargs={'pk': self.pk})
\ No newline at end of file
<!DOCTYPE HTML>
<HTML>
<Head>
<h1>Welcome to Widget!</h1>
</Head>
<h2>WIDGET USERS</h2>
<ul>
{% for Department in object_list %}
<li>{{Department.dept_name}}, {{Department.home_unit}}</li>
{% endfor %}
</ul>
</HTML>
from django.urls import path from django.urls import path
from .views import DashboardView from .views import (Dashboard_list_view, WidgetUserDetailView,
WidgetUserAddView, WidgetUserUpdateView)
urlpatterns = [ urlpatterns = [
path('', DashboardView.as_view()), path('Dashboard/', Dashboard_list_view, name='Dashboard_list_view'),
path('Widgetusers/<int:pk>/details', WidgetUserDetailView.as_view(),
name='widgetuser-detail'),
path('Widgetusers/add/', WidgetUserAddView.as_view(),
name='widgetuser-add'),
path('Widgetusers/<int:pk>/edit/', WidgetUserUpdateView.as_view(),
name='widgetuser-edit')
] ]
app_name = "Dashboard" app_name = "Dashboard"
\ No newline at end of file
from .models import Department import string
from .models import WidgetUser, Department
from django.http import HttpResponse
from django.shortcuts import render
from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from django.views import generic from django.views import generic
from django.urls import reverse
class DashboardView(generic.ListView): def Dashboard_list_view(request):
model = Department html_string_1 = '<html lang="en"><head><meta charset="UTF-8">' \
template_name = 'Dashboard/Dashboard.html' '<h1>Welcome to Widget</h1>' \
'<h2>WIDGET USERS</h2></head><ul>'
html_string_2 = ''
for wu in WidgetUser.objects.all():
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="/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):
model = WidgetUser
template_name = 'widgetuser-details.html'
queryset = WidgetUser.objects.all()
context_object_name = 'widgetuser-detail'
class WidgetUserAddView(generic.CreateView):
model = WidgetUser
fields = '__all__'
template_name = 'widgetuser-add.html'
def get_success_url(self):
return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
class WidgetUserUpdateView(generic.UpdateView):
model = WidgetUser
template_name = 'widgetuser-edit.html'
fields = '__all__'
success_url = "Dashboard/"
def get_success_url(self):
return reverse('Dashboard:widgetuser-detail', kwargs={'pk': self.object.id},
current_app=self.request.resolver_match.namespace)
\ No newline at end of file
from django.contrib import admin
from .models import Announcement, Reaction
class AnnouncementAdmin(admin.ModelAdmin):
model = Announcement
class ReactionAdmin(admin.ModelAdmin):
model = Reaction
# Register your models here.
admin.site.register(Announcement, AnnouncementAdmin)
admin.site.register(Reaction, ReactionAdmin)
\ No newline at end of file
from django.apps import AppConfig
class AnnouncementsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'announcements'
# Generated by Django 4.1.7 on 2023-03-05 14:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('Dashboard', '0002_widgetuser'),
]
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, to='announcements.announcement')),
],
),
]
from django.db import models
from Dashboard.models import WidgetUser
class Announcement(models.Model):
title = models.TextField(null=True, blank=True)
body = models.TextField(null=True, blank=True)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, null=True)
pub_datetime = models.DateTimeField(null=True)
class Reaction(models.Model):
LIKE = 'Like'
LOVE = 'Love'
ANGRY = 'Angry'
REACTION_CHOICES = [
(LIKE, 'Like'),
(LOVE, 'Love'),
(ANGRY, 'Angry'),
]
name = models.CharField(max_length=5, default=LIKE, null=True, blank=True)
tally = models.IntegerField(default=0 ,null=True, blank=True)
announcement = models.ForeignKey(Announcement, on_delete=models.CASCADE, null=True)
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "announcements"
\ No newline at end of file
from django.shortcuts import render
from django.http import HttpResponse
from .models import Announcement, Reaction
import pytz
from django.utils import timezone
def convert_to_localtime(utctime):
format = '%d/%m/%Y %I:%M %p'
utc = utctime.replace(tzinfo=pytz.UTC)
localtz = utc.astimezone(timezone.get_current_timezone())
return localtz.strftime(format)
def index(request):
html_string_1 = '<html lang="en"><head><meta charset="UTF-8"></head>\
<b><h1>Widget\'s Announcement Board</h1></b>\
<h2>Announcements:</h2><br/>'
html_string_2 = ""
for announced in Announcement.objects.all():
html_string_2 += "{} by {} {} published {}:<br />\
{}<br/>".format(announced.title, announced.author.first_name,
announced.author.last_name,
convert_to_localtime(announced.pub_datetime), announced.body)
for reacts in announced.reaction_set.all():
html_string_2 += "{}: {}<br/>".format(reacts.name, reacts.tally)
html_string_2 += '<br/>'
html_string_final = html_string_1 + html_string_2 + "</html>"
return HttpResponse(html_string_final)
# Create your views here.
from django.contrib import admin from django.contrib import admin
from .models import ForumPost, Reply, WidgetUser from .models import ForumPost, Reply
# Register your models here. # Register your models here.
admin.site.register(ForumPost) admin.site.register(ForumPost)
admin.site.register(Reply) admin.site.register(Reply)
admin.site.register(WidgetUser)
# Generated by Django 3.2 on 2023-03-06 09:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0002_auto_20230304_2337'),
]
operations = [
migrations.RenameField(
model_name='reply',
old_name='forumpost',
new_name='forum_post',
),
]
...@@ -11,7 +11,7 @@ class ForumPost(models.Model): ...@@ -11,7 +11,7 @@ class ForumPost(models.Model):
class Reply(models.Model): class Reply(models.Model):
forumpost = models.ForeignKey(ForumPost, related_name='reply', on_delete=models.CASCADE, null=True) forum_post = models.ForeignKey(ForumPost, related_name='reply', on_delete=models.CASCADE, null=True)
body = models.TextField(blank=True, null=True) body = models.TextField(blank=True, null=True)
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, null=True) author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, null=True)
pub_datetime = models.DateTimeField(auto_now_add=True) pub_datetime = models.DateTimeField(auto_now_add=True)
...@@ -6,8 +6,8 @@ from django.utils import timezone ...@@ -6,8 +6,8 @@ from django.utils import timezone
# helper function to convert utc datetime object to local time # helper function to convert utc datetime object to local time
def convert_utc_to_local(utctime): def convert_utc_to_local(utctime, format):
datetime_format = '%d/%m/%Y %I:%M %p' datetime_format = format
utc = utctime.replace(tzinfo=pytz.UTC) utc = utctime.replace(tzinfo=pytz.UTC)
localtz = utc.astimezone(timezone.get_current_timezone()) localtz = utc.astimezone(timezone.get_current_timezone())
return localtz.strftime(datetime_format) return localtz.strftime(datetime_format)
...@@ -23,12 +23,15 @@ def forum_post_list_view(request): ...@@ -23,12 +23,15 @@ def forum_post_list_view(request):
' posted <b>{}</b><p>{}</p><ul>'.format(fp.title, ' posted <b>{}</b><p>{}</p><ul>'.format(fp.title,
fp.author.first_name, fp.author.first_name,
fp.author.last_name, fp.author.last_name,
convert_utc_to_local(fp.pub_datetime), fp.body) convert_utc_to_local(fp.pub_datetime,
'%d/%m/%Y %I:%M %p'),
fp.body)
for replies in fp.reply.all(): for replies in fp.reply.all():
html_string_2 += '<li> Reply by <b>{} {}</b> ' \ html_string_2 += '<li> Reply by <b>{} {}</b> ' \
'posted <b>{}</b><p>{}</p></li>'.format(replies.author.first_name, 'posted <b>{}</b><p>{}</p></li>'.format(replies.author.first_name,
replies.author.last_name, replies.author.last_name,
convert_utc_to_local(replies.pub_datetime), convert_utc_to_local(replies.pub_datetime,
'%d/%m/%Y %I:%M %p'),
replies.body) replies.body)
html_string_2 += '</ul></li>' html_string_2 += '</ul></li>'
html_string_final = html_string_1 + html_string_2 + '</ul></html>' html_string_final = html_string_1 + html_string_2 + '</ul></html>'
......
Basgiref==3.6.0 Basgiref==3.6.0
<!DOCTYPE html>
<html>
<body>
{% block content %}
{% endblock content %}<br>
</body>
</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
from django.contrib import admin
from .models import Location, Event
class LocationAdmin(admin.ModelAdmin):
model = Location
class EventAdmin(admin.ModelAdmin):
model = Event
admin.site.register(Location, LocationAdmin)
admin.site.register(Event, EventAdmin)
from django.apps import AppConfig
class WidgetCalendarConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'widget_Calendar'
# Generated by Django 4.1.7 on 2023-03-05 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='IndexCard',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('section', models.CharField(max_length=5)),
('age', models.IntegerField()),
],
),
]
# Generated by Django 4.1.7 on 2023-03-05 16:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('widget_Calendar', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Event',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('target_datetime', models.CharField(max_length=20)),
('activity', models.CharField(max_length=100)),
('estimated_hours', models.FloatField()),
('course', models.CharField(max_length=20)),
],
),
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.DeleteModel(
name='IndexCard',
),
migrations.AddField(
model_name='event',
name='location',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='widget_Calendar.location'),
),
]
# Generated by Django 3.2 on 2023-03-06 08:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Assignments', '0002_alter_assignment_course'),
('widget_Calendar', '0002_event_location_delete_indexcard_event_location'),
]
operations = [
migrations.AlterField(
model_name='event',
name='course',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='event', to='Assignments.course'),
),
]
# Generated by Django 3.2 on 2023-03-06 08:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('widget_Calendar', '0003_alter_event_course'),
]
operations = [
migrations.AlterField(
model_name='event',
name='target_datetime',
field=models.DateTimeField(),
),
]
from django.db import models
from Assignments.models import Course
MODE_TYPES = (
('onsite', 'Onsite'),
('online', 'Online'),
('hybrid', 'Hybrid'),
)
class Location(models.Model):
mode = models.CharField(max_length=6, choices=MODE_TYPES)
venue = models.CharField(max_length=100)
def __str__(self):
return 'Mode: {} || Venue: {}'.format(self.mode, self.venue)
class Event(models.Model):
target_datetime = models.DateTimeField()
activity = models.CharField(max_length=100)
estimated_hours = models.FloatField()
location = models.ForeignKey(
Location,
on_delete=models.CASCADE
)
course = models.ForeignKey(Course, related_name='event', on_delete=models.CASCADE, null=True)
def __str__(self):
return '{} on {}'.format(self.activity, self.target_datetime)
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import index
urlpatterns = [
path('', index, name='index'),
]
app_name = "widget_Calendar"
from .models import Event, Location
from django.http import HttpResponse
from forum.views import convert_utc_to_local
def index(request):
html_string = 'robo_mommy’s Calendar of Activities<br>'
for eventItem in Event.objects.all():
html_string += '''
<br>
Date and Time: {}<br>
Activity: {}<br>
Estimated Hours: {}<br>
Course/Section: {}<br>
Mode: {}<br>
Venue: {}<br><br>
'''.format(
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,
)
return HttpResponse(html_string)
...@@ -13,9 +13,11 @@ https://docs.djangoproject.com/en/3.2/ref/settings/ ...@@ -13,9 +13,11 @@ https://docs.djangoproject.com/en/3.2/ref/settings/
from pathlib import Path from pathlib import Path
from dotenv import load_dotenv from dotenv import load_dotenv
import os import os
DIRNAME = os.path.abspath(os.path.dirname(__file__)) DIRNAME = os.path.abspath(os.path.dirname(__file__))
load_dotenv() load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
...@@ -24,7 +26,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent ...@@ -24,7 +26,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-t*s#_++5=ze%3#*ns6vcmt8a5bw6249en-!ek7*#3=p-dkhl_f' SECRET_KEY = os.getenv('SECRET_KEY')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
...@@ -35,6 +37,8 @@ ALLOWED_HOSTS = [] ...@@ -35,6 +37,8 @@ ALLOWED_HOSTS = []
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'announcements',
'Assignments',
'forum.apps.ForumConfig', 'forum.apps.ForumConfig',
'Dashboard.apps.DashboardConfig', 'Dashboard.apps.DashboardConfig',
'django.contrib.admin', 'django.contrib.admin',
...@@ -43,6 +47,7 @@ INSTALLED_APPS = [ ...@@ -43,6 +47,7 @@ INSTALLED_APPS = [
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'widget_Calendar',
'tz_detect', 'tz_detect',
] ]
...@@ -61,7 +66,8 @@ ROOT_URLCONF = 'widget_robo_mommy.urls' ...@@ -61,7 +66,8 @@ ROOT_URLCONF = 'widget_robo_mommy.urls'
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', 'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [], 'DIRS': [os.path.join(BASE_DIR, 'templates'),
'widget_robo_mommy/templates'],
'APP_DIRS': True, 'APP_DIRS': True,
'OPTIONS': { 'OPTIONS': {
'context_processors': [ 'context_processors': [
......
...@@ -14,10 +14,15 @@ Including another URLconf ...@@ -14,10 +14,15 @@ 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, include from django.urls import include, path
urlpatterns = [ urlpatterns = [
path('announcements/', include('announcements.urls', namespace="announcements")),
path('widget_Calendar/', include('widget_Calendar.urls', namespace="widget_Calendar")),
path('', include('Dashboard.urls', namespace="Dashboard")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
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