Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_gitgud
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Neal Luigi D. Rodriguez
midterm_gitgud
Commits
e90d7b7d
Commit
e90d7b7d
authored
May 15, 2023
by
Neal Luigi D. Rodriguez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'forumv2'
parents
50b9299c
49de88d0
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
353 additions
and
16 deletions
+353
-16
README.txt
README.txt
+3
-4
.DS_Store
widget_gitgud/.DS_Store
+0
-0
.DS_Store
widget_gitgud/Forum/.DS_Store
+0
-0
0004_forumpost_replies.py
widget_gitgud/Forum/migrations/0004_forumpost_replies.py
+18
-0
0005_alter_forumpost_pub_datetime_alter_reply_author.py
...s/0005_alter_forumpost_pub_datetime_alter_reply_author.py
+25
-0
0006_alter_reply_author_alter_reply_forum_post.py
...rations/0006_alter_reply_author_alter_reply_forum_post.py
+25
-0
forum.html
widget_gitgud/Forum/migrations/forum.html
+36
-0
models.py
widget_gitgud/Forum/models.py
+9
-4
.DS_Store
widget_gitgud/Forum/templates/.DS_Store
+0
-0
forum.html
widget_gitgud/Forum/templates/Forum/forum.html
+44
-0
forum.html
widget_gitgud/Forum/templates/forum.html
+44
-0
forumpost-add.html
widget_gitgud/Forum/templates/forumpost-add.html
+29
-0
forumpost-details.html
widget_gitgud/Forum/templates/forumpost-details.html
+44
-0
forumpost-edit.html
widget_gitgud/Forum/templates/forumpost-edit.html
+28
-0
urls.py
widget_gitgud/Forum/urls.py
+9
-3
views.py
widget_gitgud/Forum/views.py
+38
-3
settings.py
widget_gitgud/widget_gitgud/settings.py
+0
-1
0006_alter_event_activity.py
...ud/widgetcalendar/migrations/0006_alter_event_activity.py
+1
-1
No files found.
README.txt
View file @
e90d7b7d
...
...
@@ -6,7 +6,7 @@ Group Members:
204374 RODRIGUEZ, Neal Luigi D.
204655 SEE, Eurydice Gabrielle Madison O.
Project: Widget Version
1
Project: Widget Version
2
Apps Assigned:
DASHBOARD-Castillo
...
...
@@ -15,7 +15,7 @@ FORUM-See
ASSIGNMENTS-Rodriguez
CALENDAR-Olivares
Date of Submission: Ma
rch 6
, 2023
Date of Submission: Ma
y 15
, 2023
We as a group have worked on the project by ourselves
with no help from anyone except from our own groupmates.
...
...
@@ -24,11 +24,10 @@ presented in class. We have also cited the references
below that also helped us in our project.
References Used:
Model Field Reference. Django. (n.d.). Retrieved March 5, 2023, from https://docs.djangoproject.com/en/4.0/ref/models/fields/
Signatures:
(sgd) Gareth Xerxes Yap Castillo March 5, 2023
(sgd) Neal Luigi RODRIGUEZ March 5, 2023
(sgd) Christian Louis Olivares March 5, 2023
(sgd) Ann Colleen Garcia March 5, 2023
(sgd) Eurydice Gabrielle Madison See March 5, 2023
\ No newline at end of file
(sgd) Eurydice Gabrielle Madison See May 15, 2023
\ No newline at end of file
widget_gitgud/.DS_Store
View file @
e90d7b7d
No preview for this file type
widget_gitgud/Forum/.DS_Store
0 → 100644
View file @
e90d7b7d
File added
widget_gitgud/Forum/migrations/0004_forumpost_replies.py
0 → 100644
View file @
e90d7b7d
# Generated by Django 4.1.7 on 2023-05-11 10:32
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Forum'
,
'0003_alter_forumpost_author_alter_reply_author'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'forumpost'
,
name
=
'replies'
,
field
=
models
.
ManyToManyField
(
blank
=
True
,
to
=
'Forum.forumpost'
),
),
]
widget_gitgud/Forum/migrations/0005_alter_forumpost_pub_datetime_alter_reply_author.py
0 → 100644
View file @
e90d7b7d
# Generated by Django 4.1.7 on 2023-05-12 17:16
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Dashboard'
,
'0002_alter_widgetuser_department'
),
(
'Forum'
,
'0004_forumpost_replies'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'forumpost'
,
name
=
'pub_datetime'
,
field
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'reply'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
related_name
=
'replies'
,
to
=
'Dashboard.widgetuser'
),
),
]
widget_gitgud/Forum/migrations/0006_alter_reply_author_alter_reply_forum_post.py
0 → 100644
View file @
e90d7b7d
# Generated by Django 4.1.7 on 2023-05-12 18:57
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Dashboard'
,
'0002_alter_widgetuser_department'
),
(
'Forum'
,
'0005_alter_forumpost_pub_datetime_alter_reply_author'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'reply'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
PROTECT
,
to
=
'Dashboard.widgetuser'
),
),
migrations
.
AlterField
(
model_name
=
'reply'
,
name
=
'forum_post'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'post_replies'
,
to
=
'Forum.forumpost'
),
),
]
widget_gitgud/Forum/migrations/forum.html
0 → 100644
View file @
e90d7b7d
{% block title %}Widget's Forum{% endblock %}
{% block styles %}
<style>
body
{
background-color
:
rgb
(
253
,
222
,
207
);
font-family
:
Georgia
,
serif
;
font-size
:
16px
;
color
:
rgb
(
206
,
132
,
100
);
}
</style>
{% endblock %}
{% block content %}
<div
style=
"text-align: center;"
>
<h1>
Welcome to Widget's Forum
</h1>
</div>
<p1>
Forum posts:
</p1>
{% for post in posts %}
<li>
{{post.title}} by {{post.author}}
</li>
{% endfor %}
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<button
type=
"submit"
>
New Post
</button>
</form>
<p><a
href=
"http://127.0.0.1:8000/bookshelf/dashboard"
>
Dashboard
</a></p>
<p><a
href=
"http://127.0.0.1:8000/bookshelf/announcements"
>
Announcements
</a></p>
<p><a
href=
"http://127.0.0.1:8000/bookshelf/assignments"
>
Assignments
</a></p>
<p><a
href=
"http://127.0.0.1:8000/bookshelf/calendar"
>
Calendar
</a></p>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/models.py
View file @
e90d7b7d
from
django.db
import
models
from
Dashboard.models
import
WidgetUser
from
django.urls
import
reverse
class
ForumPost
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
PROTECT
)
pub_datetime
=
models
.
DateTimeField
()
pub_datetime
=
models
.
DateTimeField
(
auto_now_add
=
True
,
null
=
True
)
def
__str__
(
self
):
return
self
.
title
def
get_absolute_url
(
self
):
return
reverse
(
'Forum:forumpost-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
replies
=
models
.
ManyToManyField
(
'self'
,
blank
=
True
)
class
Reply
(
models
.
Model
):
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
PROTECT
)
pub_datetime
=
models
.
DateTimeField
()
forum_post
=
models
.
ForeignKey
(
ForumPost
,
on_delete
=
models
.
CASCADE
)
forum_post
=
models
.
ForeignKey
(
ForumPost
,
on_delete
=
models
.
CASCADE
,
related_name
=
'post_replies'
)
def
__str__
(
self
):
return
self
.
body
\ No newline at end of file
widget_gitgud/Forum/templates/.DS_Store
0 → 100644
View file @
e90d7b7d
File added
widget_gitgud/Forum/templates/Forum/forum.html
0 → 100644
View file @
e90d7b7d
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget's Forum{% endblock %}
{% block styles %}
<style>
body
{
background-color
:
rgb
(
253
,
222
,
207
);
font-family
:
Georgia
,
serif
;
font-size
:
16px
;
color
:
rgb
(
206
,
132
,
100
);
}
</style>
{% endblock %}
{% block content %}
<div
style=
"text-align: center;"
>
<h1>
Welcome to Widget's Forum
</h1>
</div>
<p1>
Forum posts:
</p1>
{% for post in posts %}
<li><a
href=
"{% url 'Forum:forumpost-details' pk=post.pk %}"
>
{{ post.title }} by {{ post.author }}
</a></li>
{% endfor %}
<br>
<button
type=
"submit"
>
<a
href=
"{% url 'Forum:forumpost-add' %}"
>
New Post
</a>
</button>
<br>
<br>
<a
href=
"http://127.0.0.1:8000/Dashboard/dashboard"
>
Dashboard
</a>
<br>
<a
href=
"http://127.0.0.1:8000/Announcements/announcements"
>
Announcements
</a>
<br>
<a
href=
"http://127.0.0.1:8000/Assignments/assignments"
>
Assignments
</a>
<br>
<a
href=
"http://127.0.0.1:8000/widgetcalendar/calendar"
>
Calendar
</a>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/templates/forum.html
0 → 100644
View file @
e90d7b7d
{% extends 'base.html' %}
{% load static %}
<title>
{% block title %}Widget's Forum{% endblock %}
</title>
{% block styles %}
<style>
body
{
background-color
:
rgb
(
253
,
222
,
207
);
font-family
:
Georgia
,
serif
;
font-size
:
16px
;
color
:
rgb
(
206
,
132
,
100
);
}
</style>
{% endblock %}
{% block content %}
<div
style=
"text-align: center;"
>
<h1>
Welcome to Widget's Forum
</h1>
</div>
<p1>
Forum posts:
</p1>
{% for post in posts %}
<li><a
href=
"{% url 'Forum:forumpost-details' pk=post.pk %}"
>
{{ post.title }} by {{ post.author }}
</a></li>
{% endfor %}
<br>
<button
type=
"submit"
>
<a
href=
"{% url 'Forum:forumpost-add' %}"
>
New Post
</a>
</button>
<br>
<br>
<a
href=
"http://127.0.0.1:8000/Dashboard/dashboard"
>
Dashboard
</a>
<br>
<a
href=
"http://127.0.0.1:8000/Announcements/announcements"
>
Announcements
</a>
<br>
<a
href=
"http://127.0.0.1:8000/Assignments/assignments"
>
Assignments
</a>
<br>
<a
href=
"http://127.0.0.1:8000/widgetcalendar/calendar"
>
Calendar
</a>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/templates/forumpost-add.html
0 → 100644
View file @
e90d7b7d
{% extends 'base.html' %}
{% load static %}
{% block title %} Add Post {% endblock %}
{% block styles %}
<style>
body
{
background-color
:
#FEA8A5
;
font-family
:
Georgia
,
serif
;
font-size
:
16px
;
font-weight
:
bold
;
color
:
#c35c5a
;
}
</style>
{% endblock %}
{% block content %}
<div
style=
"text-align: left;"
>
<h1>
Add a new post:
</h1>
</div>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<button
type=
"submit"
>
Save New Post
</button>
</form>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/templates/forumpost-details.html
0 → 100644
View file @
e90d7b7d
{% extends 'base.html' %}
{% load static %}
{% block title %} {{object.title}} {% endblock %}
{% block styles %}
<style>
body
{
background-color
:
rgb
(
202
,
255
,
206
);
font-family
:
Georgia
,
serif
;
font-size
:
16px
;
color
:
rgb
(
90
,
154
,
78
);
}
</style>
{% endblock %}
{% block content %}
<div
class=
"center"
>
<h1>
{{ object.title }}
</h1>
by {{ object.author }}
<br>
{{ object.pub_datetime }}
<br>
{{ object.body }}
<h2>
Post Replies:
</h2>
{% for reply in object.post_replies.all %}
by {{ reply.author }}
<br>
{{ reply.pub_datetime }}
<br>
{{ reply.body }}
{% empty %}
No replies yet.
{% endfor %}
<br>
<br>
<button
type=
"submit"
>
<a
href=
"{% url 'Forum:forumpost-edit' pk=object.pk %}"
>
Edit Post
</a>
</button>
</div>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/templates/forumpost-edit.html
0 → 100644
View file @
e90d7b7d
{% extends 'base.html' %}
{% load static %}
{% block title %} Edit Post {% endblock %}
{% block styles %}
<style>
body
{
background-color
:
#E8D1C5
;
font-family
:
Georgia
,
serif
;
font-size
:
16px
;
font-weight
:
bold
;
color
:
#a77f6a
;
}
</style>
{% endblock %}
{% block content %}
<div
style=
"text-align: left;"
>
<h1>
Edit Post
</h1>
</div>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<button
type=
"submit"
>
Save Changes to Post
</button>
</form>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/urls.py
View file @
e90d7b7d
from
django.urls
import
path
from
.views
import
index
from
.views
import
(
index
,
forum
,
ForumDetailView
,
AddForumPostView
,
EditForumPostView
,
ForumListView
)
from
.
import
views
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
""
,
views
.
index
,
name
=
"index"
),
path
(
'forum/'
,
ForumListView
.
as_view
(),
name
=
'forum'
),
path
(
'forum/forumposts/<int:pk>/details/'
,
ForumDetailView
.
as_view
(),
name
=
'forumpost-details'
),
path
(
'forum/forumposts/add/'
,
AddForumPostView
.
as_view
(),
name
=
'forumpost-add'
),
path
(
'forum/forumposts/<pk>/edit/'
,
EditForumPostView
.
as_view
(),
name
=
'forumpost-edit'
),
]
# This might be needed, depending on your Django version
app_name
=
"Forum"
\ No newline at end of file
widget_gitgud/Forum/views.py
View file @
e90d7b7d
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
UpdateView
from
django.views.generic.list
import
ListView
from
.models
import
ForumPost
from
.models
import
Reply
from
.models
import
ForumPost
,
Reply
def
index
(
request
):
return_string
=
"<br>"
...
...
@@ -15,3 +19,34 @@ def index(request):
html_string
=
"<html><head> Widget's Forum <br><br> Forum Posts: </head><body> {} </body><html>"
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
def
forum
(
request
):
posts
=
ForumPost
.
objects
.
all
()
context
=
{
'posts'
:
posts
}
return
render
(
request
,
'forum.html'
,
context
)
class
ForumListView
(
ListView
):
model
=
ForumPost
template_name
=
'forum.html'
context_object_name
=
'posts'
ordering
=
[
'-pub_datetime'
]
# sort by newest to oldest
class
ForumDetailView
(
DetailView
):
model
=
ForumPost
template_name
=
'forumpost-details.html'
context_object_name
=
'post'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
[
'replies'
]
=
self
.
object
.
replies
.
all
()
return
context
class
AddForumPostView
(
CreateView
):
model
=
ForumPost
fields
=
[
'title'
,
'body'
,
'author'
]
template_name
=
'forumpost-add.html'
class
EditForumPostView
(
UpdateView
):
model
=
ForumPost
fields
=
[
'title'
,
'body'
,
'author'
]
template_name
=
'forumpost-edit.html'
\ No newline at end of file
widget_gitgud/widget_gitgud/settings.py
View file @
e90d7b7d
...
...
@@ -18,7 +18,6 @@ load_dotenv()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR
=
Path
(
__file__
)
.
resolve
()
.
parent
.
parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
...
...
widget_gitgud/widgetcalendar/migrations/0006_alter_event_activity.py
View file @
e90d7b7d
# Generated by Django
3.2 on 2023-05-15 06:20
# Generated by Django
4.1.7 on 2023-05-11 10:32
from
django.db
import
migrations
,
models
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment