Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_jenicaesports
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
Christianneil Emmanuel Ocampo
midterm_jenicaesports
Commits
11b9e63d
Commit
11b9e63d
authored
Mar 05, 2023
by
Eldon Dagdag
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Populated models and added Inline Admin Panel
parent
65381896
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
8 deletions
+12
-8
db.sqlite3
widget_jenicaesports/db.sqlite3
+0
-0
admin.cpython-310.pyc
widget_jenicaesports/forum/__pycache__/admin.cpython-310.pyc
+0
-0
views.cpython-310.pyc
widget_jenicaesports/forum/__pycache__/views.cpython-310.pyc
+0
-0
admin.py
widget_jenicaesports/forum/admin.py
+10
-6
views.py
widget_jenicaesports/forum/views.py
+2
-2
No files found.
widget_jenicaesports/db.sqlite3
View file @
11b9e63d
No preview for this file type
widget_jenicaesports/forum/__pycache__/admin.cpython-310.pyc
View file @
11b9e63d
No preview for this file type
widget_jenicaesports/forum/__pycache__/views.cpython-310.pyc
View file @
11b9e63d
No preview for this file type
widget_jenicaesports/forum/admin.py
View file @
11b9e63d
from
django.contrib
import
admin
from
.models
import
ForumPost
,
Reply
from
.models
import
Reply
,
ForumPost
class
ReplyInline
(
admin
.
TabularInline
):
model
=
Reply
class
ForumPostAdmin
(
admin
.
ModelAdmin
):
model
=
ForumPost
class
ReplyAdmin
(
admin
.
ModelAdmin
):
model
=
Reply
search_fields
=
(
'title'
,
'author'
,)
list_display
=
(
'title'
,
'author'
,)
list_filter
=
(
'title'
,
'author'
,)
inlines
=
[
ReplyInline
]
# Register your models here.
admin
.
site
.
register
(
Reply
)
admin
.
site
.
register
(
ForumPost
,
ForumPostAdmin
)
\ No newline at end of file
admin
.
site
.
register
(
Reply
,
ReplyAdmin
)
\ No newline at end of file
widget_jenicaesports/forum/views.py
View file @
11b9e63d
...
...
@@ -9,7 +9,7 @@ def index(request):
for
post
in
ForumPost
.
objects
.
all
():
post_string
=
'{} by {} {} posted {}:<br>'
.
format
(
post
.
title
,
post
.
author
.
first_name
,
post
.
author
.
last_name
,
post
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y
%
I:
%
M
%
p"
)
post
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y
,
%
I:
%
M
%
p"
)
)
post_string
+=
'{}<br>'
.
format
(
post
.
body
)
return_string
+=
post_string
...
...
@@ -18,7 +18,7 @@ def index(request):
if
post
==
reply
.
reply_to
:
reply_string
=
'Reply by {} {} posted {}:<br>'
.
format
(
reply
.
author
.
first_name
,
reply
.
author
.
last_name
,
reply
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y
%
I:
%
M
%
p"
)
reply
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y
,
%
I:
%
M
%
p"
)
)
reply_string
+=
'{}<br>'
.
format
(
reply
.
body
)
return_string
+=
reply_string
...
...
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