Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group22
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
John Tamano
widget_group22
Commits
276424fd
Commit
276424fd
authored
Apr 05, 2022
by
Norberto Tadeo
😔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added reply model, added author relationship to reply and post, changed views.py to display data
parent
525e556e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
5 deletions
+0
-5
models.py
widget_group22/forum/models.py
+0
-4
views.py
widget_group22/forum/views.py
+0
-1
No files found.
widget_group22/forum/models.py
View file @
276424fd
...
...
@@ -2,7 +2,6 @@ from django.db import models
from
homepage.models
import
WidgetUser
class
Post
(
models
.
Model
):
#Author = WidgetUser.objects.all()
post_title
=
models
.
CharField
(
max_length
=
50
)
post_body
=
models
.
CharField
(
max_length
=
100000
)
pub_date
=
models
.
DateField
(
auto_now_add
=
True
)
...
...
@@ -17,10 +16,7 @@ class Reply(models.Model):
pub_date
=
models
.
DateField
(
auto_now_add
=
True
)
author
=
models
.
ForeignKey
(
WidgetUser
,
null
=
True
,
on_delete
=
models
.
CASCADE
,
default
=
'Anonymous'
)
active
=
models
.
BooleanField
(
default
=
True
)
#parent = models.ForeignKey('self', null=True,blank=True,related_name='replies')
#class Meta:
#ordering = ('pub_date')
def
__str__
(
self
):
if
len
(
self
.
reply_body
)
>=
50
:
return
'Reply to ({} | {}) by {} - {}... | {}'
.
format
(
self
.
post
.
post_title
,
self
.
post
.
pub_date
,
self
.
author
,
self
.
reply_body
[
0
:
50
],
self
.
pub_date
)
...
...
widget_group22/forum/views.py
View file @
276424fd
from
django.shortcuts
import
render
from
.
import
models
from
asyncio.windows_events
import
NULL
# Create your views here.
from
django.http
import
HttpResponse
def
displayForumPosts
(
request
):
...
...
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