Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_bigdjangoenergy
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
Alec Dayupay
midterm_bigdjangoenergy
Commits
1b22d175
Commit
1b22d175
authored
May 04, 2023
by
Alec Dayupay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merged forumv2
parent
333ca3b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
0004_alter_reply_pub_datetime.py
...oenergy/forum/migrations/0004_alter_reply_pub_datetime.py
+18
-0
models.py
widget_bigdjangoenergy/forum/models.py
+1
-1
views.py
widget_bigdjangoenergy/forum/views.py
+1
-1
No files found.
widget_bigdjangoenergy/forum/migrations/0004_alter_reply_pub_datetime.py
0 → 100644
View file @
1b22d175
# Generated by Django 3.2 on 2023-05-04 03:59
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'forum'
,
'0003_alter_forumpost_pub_datetime'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'reply'
,
name
=
'pub_datetime'
,
field
=
models
.
DateTimeField
(
auto_now_add
=
True
),
),
]
widget_bigdjangoenergy/forum/models.py
View file @
1b22d175
...
...
@@ -19,7 +19,7 @@ class ForumPost(models.Model):
class
Reply
(
models
.
Model
):
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
'dashboard.WidgetUser'
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
pub_datetime
=
models
.
DateTimeField
(
auto_now_add
=
True
)
forum_post
=
models
.
ForeignKey
(
'ForumPost'
,
on_delete
=
models
.
CASCADE
,
null
=
True
)
def
__str__
(
self
):
...
...
widget_bigdjangoenergy/forum/views.py
View file @
1b22d175
...
...
@@ -4,7 +4,7 @@ from django.views.generic.edit import CreateView, UpdateView
from
.models
import
ForumPost
def
forum
(
request
):
return
render
(
request
,
'forum/forum.html'
,
{
'forumposts'
:
ForumPost
.
objects
.
all
(
)})
return
render
(
request
,
'forum/forum.html'
,
{
'forumposts'
:
ForumPost
.
objects
.
order_by
(
'-pub_datetime'
)})
class
ForumPostDetailView
(
DetailView
):
model
=
ForumPost
...
...
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