Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_princessgabi
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
Ysabella Panghulan
midterm_princessgabi
Commits
e2b352df
Commit
e2b352df
authored
Mar 05, 2023
by
Trisha Angel Millena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edited admin.py and models.py
parent
b233dbd9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
admin.py
widget_princessgabi/forum/admin.py
+5
-1
models.py
widget_princessgabi/forum/models.py
+6
-0
No files found.
widget_princessgabi/forum/admin.py
View file @
e2b352df
...
@@ -3,9 +3,13 @@ from .models import ForumPost, Reply
...
@@ -3,9 +3,13 @@ from .models import ForumPost, Reply
# Register your models here.
# Register your models here.
class
ReplyInLine
(
admin
.
TabularInLine
):
model
=
Reply
class
ForumPostAdmin
(
admin
.
ModelAdmin
):
class
ForumPostAdmin
(
admin
.
ModelAdmin
):
model
=
ForumPost
model
=
ForumPost
list_display
=
(
'title'
,
'body'
,
'pub_datetime'
)
list_display
=
(
'title'
,
'body'
,
'pub_datetime'
)
inlines
=
[
ReplyInLine
]
class
ReplyAdmin
(
admin
.
ModelAdmin
):
class
ReplyAdmin
(
admin
.
ModelAdmin
):
model
=
Reply
model
=
Reply
...
...
widget_princessgabi/forum/models.py
View file @
e2b352df
...
@@ -9,8 +9,14 @@ class ForumPost(models.Model):
...
@@ -9,8 +9,14 @@ class ForumPost(models.Model):
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
pub_datetime
=
models
.
DateTimeField
()
def
_str_
(
self
):
return
self
.
title
class
Reply
(
models
.
Model
):
class
Reply
(
models
.
Model
):
body
=
models
.
CharField
(
max_length
=
300
)
body
=
models
.
CharField
(
max_length
=
300
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
pub_datetime
=
models
.
DateTimeField
()
post
=
models
.
ForeignKey
(
ForumPost
,
on_delete
=
models
.
CASCADE
)
post
=
models
.
ForeignKey
(
ForumPost
,
on_delete
=
models
.
CASCADE
)
def
_str_
(
self
):
return
self
.
author
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