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
3c88e239
Commit
3c88e239
authored
May 11, 2023
by
Eury See
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the Widget Forum page for the Forum Application.
parent
9a7fd8ba
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
6 deletions
+94
-6
.DS_Store
widget_gitgud/.DS_Store
+0
-0
.DS_Store
widget_gitgud/Forum/.DS_Store
+0
-0
forum.html
widget_gitgud/Forum/migrations/forum.html
+36
-0
.DS_Store
widget_gitgud/Forum/templates/.DS_Store
+0
-0
forum.html
widget_gitgud/Forum/templates/forum.html
+41
-0
urls.py
widget_gitgud/Forum/urls.py
+4
-3
views.py
widget_gitgud/Forum/views.py
+12
-2
base.html
widget_gitgud/templates/base.html
+0
-0
settings.py
widget_gitgud/widget_gitgud/settings.py
+1
-1
No files found.
widget_gitgud/.DS_Store
View file @
3c88e239
No preview for this file type
widget_gitgud/Forum/.DS_Store
0 → 100644
View file @
3c88e239
File added
widget_gitgud/Forum/migrations/forum.html
0 → 100644
View file @
3c88e239
{% 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/templates/.DS_Store
0 → 100644
View file @
3c88e239
File added
widget_gitgud/Forum/templates/forum.html
0 → 100644
View file @
3c88e239
<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>
{{post.title}} by {{post.author}}
</a></li>
{% endfor %}
<br>
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<button
type=
"submit"
>
New Post
</button>
</form>
<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/urls.py
View file @
3c88e239
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
index
,
forum
from
.
import
views
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
""
,
views
.
index
,
name
=
"index"
),
path
(
'forum/'
,
forum
,
name
=
'forum'
),
]
]
# This might be needed, depending on your Django version
app_name
=
"Forum"
app_name
=
"Forum"
\ No newline at end of file
widget_gitgud/Forum/views.py
View file @
3c88e239
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views
import
View
from
.models
import
ForumPost
from
.models
import
ForumPost
,
Reply
from
.models
import
Reply
def
forum
(
request
):
# Query the database to get the forum posts
posts
=
ForumPost
.
objects
.
all
()
# Pass the posts to the template
context
=
{
'posts'
:
posts
}
# Render the template
return
render
(
request
,
'forum.html'
,
context
)
def
index
(
request
):
def
index
(
request
):
return_string
=
"<br>"
return_string
=
"<br>"
...
...
widget_gitgud/template/base.html
→
widget_gitgud/template
s
/base.html
View file @
3c88e239
File moved
widget_gitgud/widget_gitgud/settings.py
View file @
3c88e239
...
@@ -18,7 +18,6 @@ load_dotenv()
...
@@ -18,7 +18,6 @@ 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
# Quick-start development settings - unsuitable for production
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/
...
@@ -62,6 +61,7 @@ ROOT_URLCONF = 'widget_gitgud.urls'
...
@@ -62,6 +61,7 @@ ROOT_URLCONF = 'widget_gitgud.urls'
TEMPLATES
=
[
TEMPLATES
=
[
{
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'template'
)],
'DIRS'
:
[],
'DIRS'
:
[],
'APP_DIRS'
:
True
,
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'OPTIONS'
:
{
...
...
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