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
a21d3721
Commit
a21d3721
authored
May 12, 2023
by
Eury See
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Post Replies in the Forum Post Details page.
parent
d73659ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
9 deletions
+34
-9
0006_alter_reply_author_alter_reply_forum_post.py
...rations/0006_alter_reply_author_alter_reply_forum_post.py
+25
-0
models.py
widget_gitgud/Forum/models.py
+3
-4
forumpost-details.html
widget_gitgud/Forum/templates/forumpost-details.html
+4
-4
views.py
widget_gitgud/Forum/views.py
+2
-1
db.sqlite3
widget_gitgud/db.sqlite3
+0
-0
No files found.
widget_gitgud/Forum/migrations/0006_alter_reply_author_alter_reply_forum_post.py
0 → 100644
View file @
a21d3721
# 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/models.py
View file @
a21d3721
...
...
@@ -18,10 +18,9 @@ class ForumPost(models.Model):
class
Reply
(
models
.
Model
):
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
PROTECT
,
related_name
=
'replies'
)
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
return
self
.
body
\ No newline at end of file
widget_gitgud/Forum/templates/forumpost-details.html
View file @
a21d3721
...
...
@@ -21,9 +21,11 @@
{{ object.body }}
<h2>
Post Replies:
</h2>
{% for reply in
replies
%}
{% for reply in
object.post_replies.all
%}
by {{ reply.author }}
<br>
{{ reply.pub_datetime }}
<br>
{{ reply.body }}
{% empty %}
No replies yet.
...
...
@@ -32,10 +34,8 @@
<br>
<br>
<button
type=
"submit"
>
<a
href=
"{% url 'Forum:forumpost-edit' pk=
forumpos
t.pk %}"
>
Edit Post
</a>
<a
href=
"{% url 'Forum:forumpost-edit' pk=
objec
t.pk %}"
>
Edit Post
</a>
</button>
</form>
</div>
{% endblock %}
\ No newline at end of file
widget_gitgud/Forum/views.py
View file @
a21d3721
...
...
@@ -34,7 +34,8 @@ class ForumListView(ListView):
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
()
...
...
widget_gitgud/db.sqlite3
View file @
a21d3721
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