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
074879db
Commit
074879db
authored
Mar 04, 2023
by
nheoxoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated models of announcements
parent
3bfe208f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
1 deletion
+90
-1
models.cpython-310.pyc
...OhMyBash/announcements/__pycache__/models.cpython-310.pyc
+0
-0
0001_initial.py
widget_OhMyBash/announcements/migrations/0001_initial.py
+34
-0
0002_alter_announcement_pub_datetime_alter_reaction_name.py
...02_alter_announcement_pub_datetime_alter_reaction_name.py
+23
-0
0001_initial.cpython-310.pyc
...ments/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
0002_alter_announcement_pub_datetime_alter_reaction_name.cpython-310.pyc
...uncement_pub_datetime_alter_reaction_name.cpython-310.pyc
+0
-0
models.py
widget_OhMyBash/announcements/models.py
+33
-1
db.sqlite3
widget_OhMyBash/db.sqlite3
+0
-0
No files found.
widget_OhMyBash/announcements/__pycache__/models.cpython-310.pyc
View file @
074879db
No preview for this file type
widget_OhMyBash/announcements/migrations/0001_initial.py
0 → 100644
View file @
074879db
# Generated by Django 4.1.7 on 2023-03-04 04:26
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Announcement'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'title'
,
models
.
CharField
(
max_length
=
100
)),
(
'body'
,
models
.
TextField
()),
(
'author'
,
models
.
CharField
(
max_length
=
100
)),
(
'pub_datetime'
,
models
.
CharField
(
max_length
=
100
)),
],
),
migrations
.
CreateModel
(
name
=
'Reaction'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
max_length
=
100
)),
(
'tally'
,
models
.
IntegerField
()),
(
'announcement'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'announcements.announcement'
)),
],
),
]
widget_OhMyBash/announcements/migrations/0002_alter_announcement_pub_datetime_alter_reaction_name.py
0 → 100644
View file @
074879db
# Generated by Django 4.1.7 on 2023-03-04 05:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'pub_datetime'
,
field
=
models
.
DateTimeField
(),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'name'
,
field
=
models
.
CharField
(
choices
=
[(
'Like'
,
'LIKE'
),
(
'Love'
,
'LOVE'
),
(
'Angry'
,
'ANGRY'
)],
default
=
'Like'
,
max_length
=
5
),
),
]
widget_OhMyBash/announcements/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
074879db
File added
widget_OhMyBash/announcements/migrations/__pycache__/0002_alter_announcement_pub_datetime_alter_reaction_name.cpython-310.pyc
0 → 100644
View file @
074879db
File added
widget_OhMyBash/announcements/models.py
View file @
074879db
from
django.db
import
models
# Create your models here.
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
body
=
models
.
TextField
()
author
=
models
.
CharField
(
max_length
=
100
)
pub_datetime
=
models
.
DateTimeField
()
def
__str__
(
self
):
return
'''{} by <authors first name> <authors last name> published {}
\n
{}'''
.
format
(
self
.
title
,
self
.
pub_datetime
,
self
.
body
)
class
Reaction
(
models
.
Model
):
REACTION_LIKE
=
"Like"
REACTION_LOVE
=
"Love"
REACTION_ANGRY
=
"Angry"
REACTION_CHOICES
=
[
(
REACTION_LIKE
,
"LIKE"
),
(
REACTION_LOVE
,
"LOVE"
),
(
REACTION_ANGRY
,
"ANGRY"
),
]
name
=
models
.
CharField
(
max_length
=
5
,
choices
=
REACTION_CHOICES
,
default
=
REACTION_LIKE
,
)
tally
=
models
.
IntegerField
()
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
'''Like: {}
\n
Love: {}
\n
Angry: {}'''
.
format
(
self
.
tally
,
self
.
tally
,
self
.
tally
)
widget_OhMyBash/db.sqlite3
View file @
074879db
No preview for this file type
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