Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
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
Angelico Ruiz T. Teaño
widget_Alipins
Commits
231659e6
Commit
231659e6
authored
Apr 03, 2022
by
Carlo Joseph Echon
🐟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added author field in Announcements and created Reaction model
parent
ef6e7a49
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
1 deletion
+69
-1
0002_announcement_author_and_more.py
...uncements/migrations/0002_announcement_author_and_more.py
+34
-0
0003_merge_20220403_1047.py
...pins/announcements/migrations/0003_merge_20220403_1047.py
+14
-0
models.py
widget_alipins/announcements/models.py
+21
-1
No files found.
widget_alipins/announcements/migrations/0002_announcement_author_and_more.py
0 → 100644
View file @
231659e6
# Generated by Django 4.0.3 on 2022-04-01 11:35
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0001_initial'
),
(
'announcements'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'announcement'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'homepage.widgetuser'
),
),
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'announcement_body'
,
field
=
models
.
TextField
(
max_length
=
1500
),
),
migrations
.
CreateModel
(
name
=
'Reaction'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'reaction_name'
,
models
.
CharField
(
choices
=
[(
'LK'
,
'Like'
),
(
'LV'
,
'Love'
),
(
'AG'
,
'Angry'
)],
default
=
'LK'
,
max_length
=
2
)),
(
'tally'
,
models
.
IntegerField
(
default
=
0
)),
(
'announcement'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'announcements.announcement'
)),
],
),
]
widget_alipins/announcements/migrations/0003_merge_20220403_1047.py
0 → 100644
View file @
231659e6
# Generated by Django 4.0.3 on 2022-04-03 02:47
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0002_alter_announcement_announcement_body'
),
(
'announcements'
,
'0002_announcement_author_and_more'
),
]
operations
=
[
]
widget_alipins/announcements/models.py
View file @
231659e6
from
django.db
import
models
from
django.db
import
models
from
homepage.models
import
WidgetUser
# Create your models here.
# Create your models here.
class
Announcement
(
models
.
Model
):
class
Announcement
(
models
.
Model
):
announcement_title
=
models
.
CharField
(
max_length
=
50
)
announcement_title
=
models
.
CharField
(
max_length
=
50
)
announcement_body
=
models
.
TextField
(
max_length
=
1500
)
announcement_body
=
models
.
TextField
(
max_length
=
1500
)
pub_date
=
models
.
DateTimeField
(
"date published"
)
pub_date
=
models
.
DateTimeField
(
"date published"
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
announcement_title
return
self
.
announcement_title
class
Reaction
(
models
.
Model
):
LIKE
=
"Like"
LOVE
=
"Love"
ANGRY
=
"Angry"
REACTION_CHOICES
=
[
(
LIKE
,
'Like'
),
(
LOVE
,
'Love'
),
(
ANGRY
,
'Angry'
),
]
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
reaction_name
=
models
.
CharField
(
max_length
=
5
,
choices
=
REACTION_CHOICES
,
default
=
LIKE
,
)
tally
=
models
.
IntegerField
(
default
=
0
)
\ No newline at end of file
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