Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group17
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
Vaughn Nephi Fajardo
widget_group17
Commits
79e48a82
Commit
79e48a82
authored
Apr 05, 2022
by
Miguel Luis D. Bandelaria
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: added foreign key Post to Reply model, associating a reply to a specific post
parent
272241dd
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
0 deletions
+26
-0
db.sqlite3
widget_group_17/db.sqlite3
+0
-0
models.cpython-39.pyc
widget_group_17/forum/__pycache__/models.cpython-39.pyc
+0
-0
0003_reply_associated_post.py
...t_group_17/forum/migrations/0003_reply_associated_post.py
+19
-0
0003_reply_associated_post.cpython-39.pyc
...ons/__pycache__/0003_reply_associated_post.cpython-39.pyc
+0
-0
models.py
widget_group_17/forum/models.py
+7
-0
No files found.
widget_group_17/db.sqlite3
View file @
79e48a82
No preview for this file type
widget_group_17/forum/__pycache__/models.cpython-39.pyc
View file @
79e48a82
No preview for this file type
widget_group_17/forum/migrations/0003_reply_associated_post.py
0 → 100644
View file @
79e48a82
# Generated by Django 4.0.3 on 2022-04-05 08:43
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0002_post_author_reply'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'reply'
,
name
=
'associated_post'
,
field
=
models
.
ForeignKey
(
null
=
True
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'post'
,
to
=
'forum.post'
),
),
]
widget_group_17/forum/migrations/__pycache__/0003_reply_associated_post.cpython-39.pyc
0 → 100644
View file @
79e48a82
File added
widget_group_17/forum/models.py
View file @
79e48a82
...
@@ -8,7 +8,14 @@ class Post(models.Model):
...
@@ -8,7 +8,14 @@ class Post(models.Model):
post_body
=
models
.
CharField
(
max_length
=
1000
)
post_body
=
models
.
CharField
(
max_length
=
1000
)
pub_date
=
models
.
DateTimeField
(
"Date published"
)
pub_date
=
models
.
DateTimeField
(
"Date published"
)
def
__str__
(
self
):
return
self
.
post_title
class
Reply
(
models
.
Model
):
class
Reply
(
models
.
Model
):
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
associated_post
=
models
.
ForeignKey
(
Post
,
on_delete
=
models
.
CASCADE
,
null
=
True
,
related_name
=
'post'
)
reply_body
=
models
.
CharField
(
max_length
=
1000
)
reply_body
=
models
.
CharField
(
max_length
=
1000
)
pub_date
=
models
.
DateTimeField
(
"Replied on"
)
pub_date
=
models
.
DateTimeField
(
"Replied on"
)
def
__str__
(
self
):
return
self
.
reply_body
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