Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_gitgud
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
Neal Luigi D. Rodriguez
midterm_gitgud
Commits
a90b30d4
Commit
a90b30d4
authored
Mar 05, 2023
by
Colleen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Announcement Board app created and modified
parent
6a0dc18f
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
97 additions
and
0 deletions
+97
-0
__init__.py
widget_gitgud/Announcement_Board/__init__.py
+0
-0
__init__.cpython-39.pyc
...ud/Announcement_Board/__pycache__/__init__.cpython-39.pyc
+0
-0
admin.cpython-39.pyc
...itgud/Announcement_Board/__pycache__/admin.cpython-39.pyc
+0
-0
apps.cpython-39.pyc
...gitgud/Announcement_Board/__pycache__/apps.cpython-39.pyc
+0
-0
models.cpython-39.pyc
...tgud/Announcement_Board/__pycache__/models.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
...gitgud/Announcement_Board/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...itgud/Announcement_Board/__pycache__/views.cpython-39.pyc
+0
-0
admin.py
widget_gitgud/Announcement_Board/admin.py
+14
-0
apps.py
widget_gitgud/Announcement_Board/apps.py
+6
-0
0001_initial.py
widget_gitgud/Announcement_Board/migrations/0001_initial.py
+34
-0
__init__.py
widget_gitgud/Announcement_Board/migrations/__init__.py
+0
-0
0001_initial.cpython-39.pyc
..._Board/migrations/__pycache__/0001_initial.cpython-39.pyc
+0
-0
__init__.cpython-39.pyc
...ment_Board/migrations/__pycache__/__init__.cpython-39.pyc
+0
-0
models.py
widget_gitgud/Announcement_Board/models.py
+17
-0
tests.py
widget_gitgud/Announcement_Board/tests.py
+3
-0
urls.py
widget_gitgud/Announcement_Board/urls.py
+8
-0
views.py
widget_gitgud/Announcement_Board/views.py
+15
-0
No files found.
widget_gitgud/Announcement_Board/__init__.py
0 → 100644
View file @
a90b30d4
widget_gitgud/Announcement_Board/__pycache__/__init__.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/__pycache__/admin.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/__pycache__/apps.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/__pycache__/models.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/__pycache__/urls.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/__pycache__/views.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/admin.py
0 → 100644
View file @
a90b30d4
from
django.contrib
import
admin
from
.models
import
Announcement
,
Reaction
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
model
=
Announcement
list_display
=
(
'title'
,
'body'
,
'author'
,
'pub_datetime'
,)
class
ReactionAdmin
(
admin
.
ModelAdmin
):
model
=
Reaction
list_display
=
(
'name'
,
'tally'
,
'announcement'
,)
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
admin
.
site
.
register
(
Reaction
,
ReactionAdmin
)
\ No newline at end of file
widget_gitgud/Announcement_Board/apps.py
0 → 100644
View file @
a90b30d4
from
django.apps
import
AppConfig
class
AnnouncementBoardConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'Announcement_Board'
widget_gitgud/Announcement_Board/migrations/0001_initial.py
0 → 100644
View file @
a90b30d4
# Generated by Django 4.1.6 on 2023-03-05 04:32
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
.
CharField
(
max_length
=
2000
)),
(
'author'
,
models
.
CharField
(
max_length
=
50
)),
(
'pub_datetime'
,
models
.
CharField
(
max_length
=
700
)),
],
),
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
()),
(
'announcement'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'Announcement_Board.announcement'
)),
],
),
]
widget_gitgud/Announcement_Board/migrations/__init__.py
0 → 100644
View file @
a90b30d4
widget_gitgud/Announcement_Board/migrations/__pycache__/0001_initial.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/migrations/__pycache__/__init__.cpython-39.pyc
0 → 100644
View file @
a90b30d4
File added
widget_gitgud/Announcement_Board/models.py
0 → 100644
View file @
a90b30d4
from
django.db
import
models
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
body
=
models
.
CharField
(
max_length
=
2000
)
author
=
models
.
CharField
(
max_length
=
50
)
pub_datetime
=
models
.
CharField
(
max_length
=
700
)
class
Reaction
(
models
.
Model
):
name_choices
=
(
(
'like'
,
'like'
),
(
'love'
,
'love'
),
(
'angry'
,
'angry'
),
)
name
=
models
.
CharField
(
max_length
=
100
,
choices
=
name_choices
)
tally
=
models
.
IntegerField
()
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
\ No newline at end of file
widget_gitgud/Announcement_Board/tests.py
0 → 100644
View file @
a90b30d4
from
django.test
import
TestCase
# Create your tests here.
widget_gitgud/Announcement_Board/urls.py
0 → 100644
View file @
a90b30d4
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"AnnouncementBoard"
\ No newline at end of file
widget_gitgud/Announcement_Board/views.py
0 → 100644
View file @
a90b30d4
from
django.shortcuts
import
render
from
django.shortcuts
import
HttpResponse
from
.models
import
Announcement
,
Reaction
def
index
(
request
):
return_string
=
'<ul>'
for
reaction
in
Reaction
.
objects
.
all
():
return_string
+=
'<li>{} {} {}: <br> {} <br> {} {} {} </li>'
.
format
(
reaction
.
announcement
.
title
,
reaction
.
announcement
.
author
,
reaction
.
announcement
.
pub_datetime
,
reaction
.
announcement
,
reaction
.
tally
,
reaction
.
tally
,
reaction
.
tally
)
return_string
+=
'</ul>'
html_string
=
'<html><head>Widget’s Announcement Board<br> <br>Announcements:</head><body>{}</body><html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
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