Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
midterm_OhMyBash
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
Nheo Samson
midterm_OhMyBash
Commits
add322b7
Commit
add322b7
authored
Mar 04, 2023
by
nheoxoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated models.py using dashboard.models
parent
8848e08d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
models.py
widget_OhMyBash/announcements/models.py
+15
-3
No files found.
widget_OhMyBash/announcements/models.py
View file @
add322b7
from
django.db
import
models
from
django.db
import
models
from
dashboard.models
import
WidgetUser
class
Announcement
(
models
.
Model
):
class
Announcement
(
models
.
Model
):
...
@@ -6,10 +7,17 @@ class Announcement(models.Model):
...
@@ -6,10 +7,17 @@ class Announcement(models.Model):
body
=
models
.
TextField
()
body
=
models
.
TextField
()
author
=
models
.
CharField
(
max_length
=
100
)
author
=
models
.
CharField
(
max_length
=
100
)
pub_datetime
=
models
.
DateTimeField
()
pub_datetime
=
models
.
DateTimeField
()
first_name
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
last_name
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'''{} by <authors first name> <authors last name> published {}
return
'''{} by {} {} published {}
\n
{}'''
.
format
(
\n
{}'''
.
format
(
self
.
title
,
self
.
pub_datetime
,
self
.
body
)
self
.
title
,
self
.
first_name
,
self
.
last_name
,
self
.
pub_datetime
,
self
.
body
,
)
class
Reaction
(
models
.
Model
):
class
Reaction
(
models
.
Model
):
...
@@ -32,4 +40,8 @@ class Reaction(models.Model):
...
@@ -32,4 +40,8 @@ class Reaction(models.Model):
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'''Like: {}
\n
Love: {}
\n
Angry: {}'''
.
format
(
self
.
tally
,
self
.
tally
,
self
.
tally
)
return
'''Like: {}
\n
Love: {}
\n
Angry: {}'''
.
format
(
self
.
tally
,
self
.
tally
,
self
.
tally
,
)
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