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
d73659ee
Commit
d73659ee
authored
May 12, 2023
by
Eury See
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited the links to the pages' buttons and fixed minor details.
parent
e8f4b864
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
16 deletions
+25
-16
forum.html
widget_gitgud/Forum/templates/forum.html
+7
-7
forumpost-details.html
widget_gitgud/Forum/templates/forumpost-details.html
+8
-7
urls.py
widget_gitgud/Forum/urls.py
+3
-2
views.py
widget_gitgud/Forum/views.py
+7
-0
db.sqlite3
widget_gitgud/db.sqlite3
+0
-0
No files found.
widget_gitgud/Forum/templates/forum.html
View file @
d73659ee
...
...
@@ -20,16 +20,16 @@
<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>
<li><a
href=
"{% url 'Forum:forumpost-details' pk=post.pk %}"
>
{{
post.title }} by {{ post.author
}}
</a></li>
{% endfor %}
<br>
<form
method=
"post"
>
{% csrf_token %}
{{form.as_p}}
<button
type=
"submit"
>
New Post
</button>
</form>
<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>
...
...
widget_gitgud/Forum/templates/forumpost-details.html
View file @
d73659ee
...
...
@@ -20,7 +20,7 @@
<br>
{{ object.body }}
<
p>
Post Replies:
</p
>
<
h2>
Post Replies:
</h2
>
{% for reply in replies %}
by {{ reply.author }}
{{ reply.pub_datetime }}
...
...
@@ -29,12 +29,13 @@
No replies yet.
{% endfor %}
<
form
method=
"post"
>
{% csrf_token %}
<br>
<button
type=
"submit"
>
Edit Post
<
br
>
<br>
<button
type=
"submit"
>
<a
href=
"{% url 'Forum:forumpost-edit' pk=forumpost.pk %}"
>
Edit Post
</a>
</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/urls.py
View file @
d73659ee
from
django.urls
import
path
from
.views
import
(
index
,
forum
,
ForumDetailView
,
AddForumPostView
,
EditForumPostView
)
index
,
forum
,
ForumDetailView
,
AddForumPostView
,
EditForumPostView
,
ForumListView
)
from
.
import
views
urlpatterns
=
[
path
(
""
,
views
.
index
,
name
=
"index"
),
path
(
'forum/'
,
forum
,
name
=
'forum'
),
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'
),
...
...
widget_gitgud/Forum/views.py
View file @
d73659ee
...
...
@@ -4,6 +4,7 @@ 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
,
Reply
...
...
@@ -24,6 +25,12 @@ def forum(request):
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'
...
...
widget_gitgud/db.sqlite3
View file @
d73659ee
No preview for this file type
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