Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_appappandaway
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
Ian Rafael T. Aragoza
midterm_appappandaway
Commits
23ff524b
Commit
23ff524b
authored
Mar 04, 2023
by
Ian Rafael T. Aragoza
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'announcementboard_feature' into dashboard_feature
parents
d68c8695
b35c0529
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
4 deletions
+53
-4
admin.py
widget_appappandaway/announcementboard/admin.py
+21
-0
models.py
widget_appappandaway/announcementboard/models.py
+27
-0
views.py
widget_appappandaway/announcementboard/views.py
+1
-1
settings.py
widget_appappandaway/widget_appappandaway/settings.py
+1
-0
urls.py
widget_appappandaway/widget_appappandaway/urls.py
+3
-3
No files found.
widget_appappandaway/announcementboard/admin.py
View file @
23ff524b
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
Announcement
,
Reaction
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
model
=
Announcement
search_fields
=
(
'title'
,
'author'
)
list_display
=
(
'title'
,
'author'
,
'pub_datetime'
,
'body'
)
class
ReactionAdmin
(
admin
.
ModelAdmin
):
model
=
Reaction
search_fields
=
(
'name'
,
'announcement'
)
list_display
=
(
'announcement'
,
'name'
,
'tally'
)
# Register your models here.
# Register your models here.
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
admin
.
site
.
register
(
Reaction
,
ReactionAdmin
)
\ No newline at end of file
widget_appappandaway/announcementboard/models.py
View file @
23ff524b
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
from
dashboard.models
import
WidgetUser
# Create your models here.
# Create your models here.
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
255
)
body
=
models
.
TextField
()
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
pub_datetime
=
models
.
DateTimeField
()
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
title
)
def
get_absolute_url
(
self
):
return
reverse
(
'announcement_detail'
,
args
=
[
str
(
self
.
title
)])
class
Reaction
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
)
tally
=
models
.
IntegerField
()
announcement
=
models
.
ForeignKey
(
Announcement
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
name
)
def
get_absolute_url
(
self
):
return
reverse
(
'reaction_detail'
,
args
=
[
str
(
self
.
name
)])
widget_appappandaway/announcementboard/views.py
View file @
23ff524b
...
@@ -4,4 +4,4 @@ from django.http import HttpResponse
...
@@ -4,4 +4,4 @@ from django.http import HttpResponse
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
return
HttpResponse
(
'Announcement Board app.'
)
return
HttpResponse
(
"Widget's Announcement Board <br> Announcements: <br>"
)
widget_appappandaway/widget_appappandaway/settings.py
View file @
23ff524b
...
@@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
...
@@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/4.1/ref/settings/
from
pathlib
import
Path
from
pathlib
import
Path
from
dotenv
import
load_dotenv
from
dotenv
import
load_dotenv
import
os
import
os
load_dotenv
()
load_dotenv
()
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# Build paths inside the project like this: BASE_DIR / 'subdir'.
...
...
widget_appappandaway/widget_appappandaway/urls.py
View file @
23ff524b
...
@@ -17,8 +17,8 @@ from django.contrib import admin
...
@@ -17,8 +17,8 @@ from django.contrib import admin
from
django.urls
import
include
,
path
from
django.urls
import
include
,
path
urlpatterns
=
[
urlpatterns
=
[
path
(
'dashboard'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'dashboard
/
'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
path
(
'announcementboard'
,
include
(
'announcementboard.urls'
,
namespace
=
"announcementboard"
)),
path
(
'announcementboard
/
'
,
include
(
'announcementboard.urls'
,
namespace
=
"announcementboard"
)),
path
(
'forum'
,
include
(
'forum.urls'
,
namespace
=
"forum"
)),
path
(
'forum
/
'
,
include
(
'forum.urls'
,
namespace
=
"forum"
)),
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