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
b540172a
Commit
b540172a
authored
Apr 06, 2022
by
Julliana Zarah C. Cruz
Browse files
Options
Browse Files
Download
Plain Diff
Fixed conflicts in merging and merging
parents
ae0eab8e
1f97f1bd
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
354 additions
and
11 deletions
+354
-11
admin.py
widget_group22/announcements/admin.py
+13
-4
0001_initial.py
widget_group22/announcements/migrations/0001_initial.py
+2
-1
0002_reaction.py
widget_group22/announcements/migrations/0002_reaction.py
+21
-0
0003_announcement_author.py
...up22/announcements/migrations/0003_announcement_author.py
+21
-0
0004_remove_reaction_id_announcement_reaction_and_more.py
...0004_remove_reaction_id_announcement_reaction_and_more.py
+28
-0
0005_alter_announcement_announcement_body.py
...s/migrations/0005_alter_announcement_announcement_body.py
+18
-0
0006_remove_announcement_reaction_reaction_announcement.py
...006_remove_announcement_reaction_reaction_announcement.py
+24
-0
0007_remove_reaction_tally_reaction_id.py
...ents/migrations/0007_remove_reaction_tally_reaction_id.py
+23
-0
0008_reaction_tally.py
...t_group22/announcements/migrations/0008_reaction_tally.py
+18
-0
0009_alter_reaction_tally.py
...p22/announcements/migrations/0009_alter_reaction_tally.py
+18
-0
0010_merge_20220406_2319.py
...up22/announcements/migrations/0010_merge_20220406_2319.py
+14
-0
0011_alter_announcement_announcement_title.py
.../migrations/0011_alter_announcement_announcement_title.py
+18
-0
0012_alter_announcement_author_and_more.py
...nts/migrations/0012_alter_announcement_author_and_more.py
+25
-0
0013_alter_announcement_author_and_more.py
...nts/migrations/0013_alter_announcement_author_and_more.py
+30
-0
0014_alter_reaction_reaction_name.py
...uncements/migrations/0014_alter_reaction_reaction_name.py
+18
-0
models.py
widget_group22/announcements/models.py
+36
-3
urls.py
widget_group22/announcements/urls.py
+2
-2
views.py
widget_group22/announcements/views.py
+25
-1
No files found.
widget_group22/announcements/admin.py
View file @
b540172a
from
django.contrib
import
admin
from
.models
import
Announcement
from
.models
import
Announcement
,
Reaction
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
model
=
Announcement
list_display
=
(
'announcement_title'
,
'pub_date'
)
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
\ No newline at end of file
class
ReactionAdmin
(
admin
.
ModelAdmin
):
model
=
Reaction
list_display
=
(
'announcement'
,
'reaction_name'
,
'tally'
)
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
admin
.
site
.
register
(
Reaction
,
ReactionAdmin
)
\ No newline at end of file
widget_group22/announcements/migrations/0001_initial.py
View file @
b540172a
# Generated by Django 4.0.3 on 2022-03-18 15:12
# Generated by Django 4.0.3 on 2022-03-18 15:12
# Generated by Django 4.0.3 on 2022-04-05 04:20
from
django.db
import
migrations
,
models
...
...
widget_group22/announcements/migrations/0002_reaction.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-05 05:00
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0001_initial'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Reaction'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'reaction_name'
,
models
.
CharField
(
choices
=
[(
'Like'
,
'Like'
),
(
'Love'
,
'Love'
),
(
'Angry'
,
'Angry'
)],
max_length
=
5
)),
(
'tally'
,
models
.
PositiveIntegerField
()),
],
),
]
widget_group22/announcements/migrations/0003_announcement_author.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-05 06:52
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0001_initial'
),
(
'announcements'
,
'0002_reaction'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'announcement'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'homepage.widgetuser'
),
preserve_default
=
False
,
),
]
widget_group22/announcements/migrations/0004_remove_reaction_id_announcement_reaction_and_more.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-05 08:27
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0003_announcement_author'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'reaction'
,
name
=
'id'
,
),
migrations
.
AddField
(
model_name
=
'announcement'
,
name
=
'reaction'
,
field
=
models
.
ForeignKey
(
blank
=
True
,
default
=
None
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'announcements.reaction'
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'tally'
,
field
=
models
.
AutoField
(
primary_key
=
True
,
serialize
=
False
),
),
]
widget_group22/announcements/migrations/0005_alter_announcement_announcement_body.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-05 08:39
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0004_remove_reaction_id_announcement_reaction_and_more'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'announcement_body'
,
field
=
models
.
TextField
(),
),
]
widget_group22/announcements/migrations/0006_remove_announcement_reaction_reaction_announcement.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-05 08:53
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0005_alter_announcement_announcement_body'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'announcement'
,
name
=
'reaction'
,
),
migrations
.
AddField
(
model_name
=
'reaction'
,
name
=
'announcement'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'announcements.announcement'
),
preserve_default
=
False
,
),
]
widget_group22/announcements/migrations/0007_remove_reaction_tally_reaction_id.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 02:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0006_remove_announcement_reaction_reaction_announcement'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'reaction'
,
name
=
'tally'
,
),
migrations
.
AddField
(
model_name
=
'reaction'
,
name
=
'id'
,
field
=
models
.
BigAutoField
(
auto_created
=
True
,
default
=
1
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
),
preserve_default
=
False
,
),
]
widget_group22/announcements/migrations/0008_reaction_tally.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 07:24
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0007_remove_reaction_tally_reaction_id'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'reaction'
,
name
=
'tally'
,
field
=
models
.
IntegerField
(
default
=
1
),
),
]
widget_group22/announcements/migrations/0009_alter_reaction_tally.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 11:50
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0008_reaction_tally'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'tally'
,
field
=
models
.
IntegerField
(
default
=
0
),
),
]
widget_group22/announcements/migrations/0010_merge_20220406_2319.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 15:19
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0002_alter_announcement_announcement_title'
),
(
'announcements'
,
'0009_alter_reaction_tally'
),
]
operations
=
[
]
widget_group22/announcements/migrations/0011_alter_announcement_announcement_title.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 15:23
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0010_merge_20220406_2319'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'announcement_title'
,
field
=
models
.
CharField
(
max_length
=
100
),
),
]
widget_group22/announcements/migrations/0012_alter_announcement_author_and_more.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 15:58
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0006_widgetuser_department'
),
(
'announcements'
,
'0011_alter_announcement_announcement_title'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'homepage.widgetuser'
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'reaction_name'
,
field
=
models
.
CharField
(
choices
=
[(
'Like'
,
'Like'
),
(
'Love'
,
'Love'
),
(
'Angry'
,
'Angry'
)],
default
=
1
,
max_length
=
5
),
),
]
widget_group22/announcements/migrations/0013_alter_announcement_author_and_more.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 16:00
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'homepage'
,
'0006_widgetuser_department'
),
(
'announcements'
,
'0012_alter_announcement_author_and_more'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'announcement'
,
name
=
'author'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'homepage.widgetuser'
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'announcement'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'announcements.announcement'
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'reaction_name'
,
field
=
models
.
CharField
(
choices
=
[(
'Like'
,
'Like'
),
(
'Love'
,
'Love'
),
(
'Angry'
,
'Angry'
)],
max_length
=
5
),
),
]
widget_group22/announcements/migrations/0014_alter_reaction_reaction_name.py
0 → 100644
View file @
b540172a
# Generated by Django 4.0.3 on 2022-04-06 16:03
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcements'
,
'0013_alter_announcement_author_and_more'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'reaction_name'
,
field
=
models
.
CharField
(
choices
=
[(
'Like'
,
'Like'
),
(
'Love'
,
'Love'
),
(
'Angry'
,
'Angry'
)],
default
=
1
,
max_length
=
5
),
),
]
widget_group22/announcements/models.py
View file @
b540172a
from
django.db
import
models
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
,
)
tally
=
models
.
IntegerField
(
default
=
0
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
reaction_name
)
def
get_tally
(
self
):
return
'{}'
.
format
(
self
.
tally
)
class
Announcement
(
models
.
Model
):
announcement_title
=
models
.
CharField
(
max_length
=
50
)
announcement_body
=
models
.
CharField
(
max_length
=
400
)
pub_date
=
models
.
DateField
(
auto_now_add
=
True
)
announcement_title
=
models
.
CharField
(
max_length
=
100
)
announcement_body
=
models
.
TextField
(
default
=
''
)
pub_date
=
models
.
DateField
(
auto_now_add
=
True
)
author
=
models
.
ForeignKey
(
'homepage.WidgetUser'
,
on_delete
=
models
.
CASCADE
,
default
=
1
,
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
announcement_title
)
\ No newline at end of file
widget_group22/announcements/urls.py
View file @
b540172a
from
django.urls
import
path
from
.views
import
index
from
.views
import
announcements
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index
'
),
path
(
''
,
announcements
,
name
=
'announcements
'
),
]
app_name
=
"announcements"
widget_group22/announcements/views.py
View file @
b540172a
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.
import
models
from
.models
import
Announcement
,
Reaction
def
index
(
request
):
return
HttpResponse
(
'This is the Announcement Board!'
)
# Create your views here.
def
announcements
(
request
):
all_announcements
=
models
.
Announcement
.
objects
.
all
()
all_reactions
=
models
.
Reaction
.
objects
.
all
()
final_output
=
''
for
i
in
all_announcements
:
title
=
i
.
announcement_title
body
=
i
.
announcement_body
date
=
str
(
i
.
pub_date
)
last_name
=
i
.
author
.
last_name
first_name
=
i
.
author
.
first_name
like_tally
=
str
(
Reaction
.
objects
.
get
(
reaction_name
=
'Like'
,
announcement
=
i
)
.
get_tally
())
love_tally
=
str
(
Reaction
.
objects
.
get
(
reaction_name
=
'Love'
,
announcement
=
i
)
.
get_tally
())
angry_tally
=
str
(
Reaction
.
objects
.
get
(
reaction_name
=
'Angry'
,
announcement
=
i
)
.
get_tally
())
output
=
(
title
+
' by '
+
first_name
+
' '
+
last_name
+
' dated '
+
date
+
':<br>'
+
body
+
'<br>'
+
'Like: '
+
like_tally
+
'<br>'
+
'Love: '
+
love_tally
+
'<br>'
+
'Angry: '
+
angry_tally
)
final_output
+=
output
+
'<br><br>'
return
HttpResponse
(
'<h1>ANNOUNCEMENTS: </h1>'
+
final_output
)
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