Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_aguandhischipmunks
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
Adrian Lance Damalerio
midterm_aguandhischipmunks
Commits
00d6d9f0
Commit
00d6d9f0
authored
Mar 06, 2023
by
Deokhyun Lee
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'announcements_wip'
parents
36d2898e
3b5393e1
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
146 additions
and
6 deletions
+146
-6
README.txt
README.txt
+3
-1
admin.py
widget_aguandhischipmunks/announcement_board/admin.py
+22
-1
0001_initial.py
...ischipmunks/announcement_board/migrations/0001_initial.py
+35
-0
0002_auto_20230305_2319.py
.../announcement_board/migrations/0002_auto_20230305_2319.py
+23
-0
0001_initial.cpython-310.pyc
...board/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
0002_auto_20230305_2319.cpython-310.pyc
...tions/__pycache__/0002_auto_20230305_2319.cpython-310.pyc
+0
-0
models.py
widget_aguandhischipmunks/announcement_board/models.py
+17
-1
urls.py
widget_aguandhischipmunks/announcement_board/urls.py
+11
-0
views.py
widget_aguandhischipmunks/announcement_board/views.py
+33
-2
urls.cpython-310.pyc
...ndhischipmunks/dashboard/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...dhischipmunks/dashboard/__pycache__/views.cpython-310.pyc
+0
-0
0001_initial.cpython-310.pyc
...board/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
0002_alter_widgetuser_department.cpython-310.pyc
...ycache__/0002_alter_widgetuser_department.cpython-310.pyc
+0
-0
urls.py
widget_aguandhischipmunks/widget_aguandhischipmunks/urls.py
+2
-1
No files found.
README.txt
View file @
00d6d9f0
...
...
@@ -3,7 +3,7 @@ Section C
Group Members:
Damalerio, Adrian Lance T.
[Insert Name]
Syquia, Luis Augusto A.
[Insert Name]
[Insert Name]
[Insert Name]
...
...
@@ -11,6 +11,7 @@ Damalerio, Adrian Lance T.
Midterm Proj: Widget v1
App Assignments:
Announcement Board - Syquia
Date of Submission:
...
...
@@ -19,3 +20,4 @@ Date of Submission:
[References]
(sgd) Adrian Lance T. Damalerio
(sgd) Luis Augusto A. Syquia
widget_aguandhischipmunks/announcement_board/admin.py
View file @
00d6d9f0
from
django.contrib
import
admin
from
.models
import
Announcement
,
Reaction
# Register your models here.
class
ReactionInline
(
admin
.
TabularInline
):
model
=
Reaction
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
model
=
Announcement
search_fields
=
(
'title'
,
'author'
,)
list_display
=
(
'title'
,
'body'
,
'author'
,
'pub_datetime'
,)
list_filter
=
(
'title'
,
'author'
,
'pub_datetime'
,)
inlines
=
[
ReactionInline
,]
class
ReactionAdmin
(
admin
.
ModelAdmin
):
model
=
Reaction
search_fields
=
(
'name'
,
'announcement'
,)
list_display
=
(
'name'
,
'tally'
,
'announcement'
,)
list_filter
=
(
'name'
,
'tally'
,)
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
admin
.
site
.
register
(
Reaction
,
ReactionAdmin
)
widget_aguandhischipmunks/announcement_board/migrations/0001_initial.py
0 → 100644
View file @
00d6d9f0
# Generated by Django 3.2 on 2023-03-05 14:28
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
(
'dashboard'
,
'0002_alter_widgetuser_department'
),
]
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
=
50
)),
(
'body'
,
models
.
TextField
(
max_length
=
420
)),
(
'pub_datetime'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'author'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'dashboard.widgetuser'
)),
],
),
migrations
.
CreateModel
(
name
=
'Reaction'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
choices
=
[(
'Like'
,
'Like'
),
(
'Love'
,
'Love'
),
(
'Angry'
,
'Angry'
)],
max_length
=
100
)),
(
'tally'
,
models
.
IntegerField
(
default
=
1
)),
(
'announcement'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'announcement_board.announcement'
)),
],
),
]
widget_aguandhischipmunks/announcement_board/migrations/0002_auto_20230305_2319.py
0 → 100644
View file @
00d6d9f0
# Generated by Django 3.2 on 2023-03-05 15:19
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'announcement_board'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'name'
,
field
=
models
.
CharField
(
max_length
=
100
),
),
migrations
.
AlterField
(
model_name
=
'reaction'
,
name
=
'tally'
,
field
=
models
.
IntegerField
(
default
=
0
),
),
]
widget_aguandhischipmunks/announcement_board/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
00d6d9f0
File added
widget_aguandhischipmunks/announcement_board/migrations/__pycache__/0002_auto_20230305_2319.cpython-310.pyc
0 → 100644
View file @
00d6d9f0
File added
widget_aguandhischipmunks/announcement_board/models.py
View file @
00d6d9f0
from
django.db
import
models
from
dashboard.models
import
WidgetUser
# Create your models here.
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
body
=
models
.
TextField
(
max_length
=
420
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
(
auto_now_add
=
True
)
def
__str__
(
self
):
return
self
.
title
class
Reaction
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
tally
=
models
.
IntegerField
(
default
=
0
)
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
self
.
name
widget_aguandhischipmunks/announcement_board/urls.py
0 → 100644
View file @
00d6d9f0
#announcements/urls.py
from
django.urls
import
path
from
.
import
views
urlpatterns
=
[
path
(
""
,
views
.
announcement_boardIndex
,
name
=
"announcement_boardIndex"
)
]
app_name
=
"announcement_board"
\ No newline at end of file
widget_aguandhischipmunks/announcement_board/views.py
View file @
00d6d9f0
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Announcement
,
Reaction
def
announcement_boardIndex
(
request
):
announcements
=
Announcement
.
objects
.
all
()
reactions
=
Reaction
.
objects
.
all
()
announcement_board_output
=
"Widget’s Announcement Board <br><br> Announcements: <br>"
for
announcement
in
announcements
:
datetime
=
announcement
.
pub_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p"
)
announcement_board_output
+=
(
announcement
.
title
+
" by "
+
announcement
.
author
.
first_name
+
" "
+
announcement
.
author
.
last_name
+
" published "
+
datetime
+
": <br>"
+
announcement
.
body
+
"<br>"
)
like_tally
=
0
love_tally
=
0
angry_tally
=
0
for
reaction
in
reactions
:
if
reaction
.
announcement
.
title
==
announcement
.
title
:
if
reaction
.
name
==
"Like"
:
like_tally
=
reaction
.
tally
elif
reaction
.
name
==
"Love"
:
love_tally
=
reaction
.
tally
elif
reaction
.
name
==
"Angry"
:
angry_tally
=
reaction
.
tally
announcement_board_output
=
(
announcement_board_output
+
"Like: "
+
str
(
like_tally
)
+
"<br>Love: "
+
str
(
love_tally
)
+
"<br>Angry: "
+
str
(
angry_tally
)
+
"<br><br>"
)
return
HttpResponse
(
announcement_board_output
)
\ No newline at end of file
# Create your views here.
widget_aguandhischipmunks/dashboard/__pycache__/urls.cpython-310.pyc
0 → 100644
View file @
00d6d9f0
File added
widget_aguandhischipmunks/dashboard/__pycache__/views.cpython-310.pyc
0 → 100644
View file @
00d6d9f0
File added
widget_aguandhischipmunks/dashboard/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
00d6d9f0
File added
widget_aguandhischipmunks/dashboard/migrations/__pycache__/0002_alter_widgetuser_department.cpython-310.pyc
0 → 100644
View file @
00d6d9f0
File added
widget_aguandhischipmunks/widget_aguandhischipmunks/urls.py
View file @
00d6d9f0
...
...
@@ -21,5 +21,6 @@ urlpatterns = [
path
(
"dashboard/"
,
include
(
"dashboard.urls"
,
namespace
=
"dashboard"
)),
path
(
"assignments/"
,
include
(
"assignments.urls"
)),
path
(
"forum/"
,
include
(
"forum.urls"
)),
path
(
"calendar/"
,
include
(
"calendar_app.urls"
))
path
(
"calendar/"
,
include
(
"calendar_app.urls"
)),
path
(
"announcements/"
,
include
(
"announcement_board.urls"
,
namespace
=
"announcement_board"
)),
]
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