Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_huli
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
Izaac Daniel B. Muncal
midterm_huli
Commits
18b6b350
Commit
18b6b350
authored
Mar 06, 2023
by
Brescia Amandy
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Announcement_Board' into 'master'
Announcement board See merge request
!5
parents
20150d91
2a99b6a5
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
91 additions
and
2 deletions
+91
-2
__init__.py
widget_huli/Announcement_Board/__init__.py
+0
-0
admin.py
widget_huli/Announcement_Board/admin.py
+16
-0
apps.py
widget_huli/Announcement_Board/apps.py
+6
-0
__init__.py
widget_huli/Announcement_Board/migrations/__init__.py
+0
-0
models.py
widget_huli/Announcement_Board/models.py
+23
-0
tests.py
widget_huli/Announcement_Board/tests.py
+3
-0
urls.py
widget_huli/Announcement_Board/urls.py
+8
-0
views.py
widget_huli/Announcement_Board/views.py
+30
-0
__init__.cpython-311.pyc
widget_huli/widget_huli/__pycache__/__init__.cpython-311.pyc
+0
-0
settings.cpython-311.pyc
widget_huli/widget_huli/__pycache__/settings.cpython-311.pyc
+0
-0
settings.py
widget_huli/widget_huli/settings.py
+1
-0
urls.py
widget_huli/widget_huli/urls.py
+4
-2
No files found.
widget_huli/Announcement_Board/__init__.py
0 → 100644
View file @
18b6b350
widget_huli/Announcement_Board/admin.py
0 → 100644
View file @
18b6b350
from
django.contrib
import
admin
from
.models
import
Reaction
,
Announcement
# Register your models here.
class
ReactionInLine
(
admin
.
TabularInline
):
model
=
Reaction
extra
=
1
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
inlines
=
[
ReactionInLine
,]
list_display
=
(
'title'
,
'author'
,
'pub_datetime'
,
'body'
)
search_fields
=
(
'title'
,
'author'
,
'body'
)
list_filter
=
(
'author'
,
'pub_datetime'
)
widget_huli/Announcement_Board/apps.py
0 → 100644
View file @
18b6b350
from
django.apps
import
AppConfig
class
AnnouncementBoardConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'Announcement_Board'
widget_huli/Announcement_Board/migrations/__init__.py
0 → 100644
View file @
18b6b350
widget_huli/Announcement_Board/models.py
0 → 100644
View file @
18b6b350
from
django.db
import
models
from
django.urls
import
reverse
from
dashboard.model
import
WidgetUser
# Create your models here.
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
class
Reaction
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
tally
=
models
.
IntegerField
()
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
widget_huli/Announcement_Board/tests.py
0 → 100644
View file @
18b6b350
from
django.test
import
TestCase
# Create your tests here.
widget_huli/Announcement_Board/urls.py
0 → 100644
View file @
18b6b350
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"Announcement_Board"
widget_huli/Announcement_Board/views.py
0 → 100644
View file @
18b6b350
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Announcement
,
Reaction
# Create your views here.
def
index
(
request
):
return_string
=
'<body> <ul>'
reaction_string
=
''
for
announcement
in
Announcement
.
objects
.
all
():
announcement_string
=
'<li>{} by {} published <br>{}</li>'
.
format
(
announcement
.
title
,
announcement
.
author
,
announcement
.
pub_datetime
.
strftime
(
'
%
m/
%
d/
%
Y
%
H:
%
M
%
p'
),
announcement
.
body
)
for
reaction
in
Reaction
.
objects
.
all
():
if
reaction
.
announcement
==
announcement
:
reaction_string
+=
'<li>{}: {}</li>'
.
format
(
reaction
.
name
,
reaction
.
tally
)
return_string
+=
announcement_string
return_string
+=
reaction_string
return_string
+=
'<br>'
return_string
+=
'</ul></body>'
html_string
=
'<htmk>{}</html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
\ No newline at end of file
widget_huli/widget_huli/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
18b6b350
File added
widget_huli/widget_huli/__pycache__/settings.cpython-311.pyc
0 → 100644
View file @
18b6b350
File added
widget_huli/widget_huli/settings.py
View file @
18b6b350
...
@@ -39,6 +39,7 @@ INSTALLED_APPS = [
...
@@ -39,6 +39,7 @@ INSTALLED_APPS = [
'django.contrib.sessions'
,
'django.contrib.sessions'
,
'django.contrib.messages'
,
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'django.contrib.staticfiles'
,
'Announcement_Board'
,
]
]
MIDDLEWARE
=
[
MIDDLEWARE
=
[
...
...
widget_huli/widget_huli/urls.py
View file @
18b6b350
...
@@ -14,9 +14,11 @@ Including another URLconf
...
@@ -14,9 +14,11 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
"""
from
django.contrib
import
admin
from
django.contrib
import
admin
from
django.urls
import
path
,
include
from
django.urls
import
include
,
path
urlpatterns
=
[
urlpatterns
=
[
path
(
'dashboard'
,
include
(
'dashboard.urls'
)),
path
(
'Announcement_Board/'
,
include
(
'Announcement_Board.urls'
,
namespace
=
"Announcement_Board"
)),
path
(
'dashboard'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
]
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