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
da596da1
Commit
da596da1
authored
Mar 06, 2023
by
Deokhyun Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
code general format is now clear and concise.
parent
f88bc03e
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
40 additions
and
34 deletions
+40
-34
.DS_Store
.DS_Store
+0
-0
admin.py
widget_aguandhischipmunks/announcement_board/admin.py
+3
-1
models.py
widget_aguandhischipmunks/announcement_board/models.py
+5
-0
urls.py
widget_aguandhischipmunks/announcement_board/urls.py
+2
-4
views.py
widget_aguandhischipmunks/announcement_board/views.py
+1
-0
urls.py
widget_aguandhischipmunks/assignments/urls.py
+2
-3
views.py
widget_aguandhischipmunks/assignments/views.py
+3
-5
models.py
widget_aguandhischipmunks/calendar_app/models.py
+8
-9
urls.py
widget_aguandhischipmunks/calendar_app/urls.py
+1
-2
views.py
widget_aguandhischipmunks/calendar_app/views.py
+1
-0
models.py
widget_aguandhischipmunks/dashboard/models.py
+4
-2
urls.py
widget_aguandhischipmunks/dashboard/urls.py
+1
-2
views.py
widget_aguandhischipmunks/dashboard/views.py
+1
-3
admin.py
widget_aguandhischipmunks/forum/admin.py
+2
-2
models.py
widget_aguandhischipmunks/forum/models.py
+4
-1
urls.py
widget_aguandhischipmunks/forum/urls.py
+1
-0
views.py
widget_aguandhischipmunks/forum/views.py
+1
-0
No files found.
.DS_Store
0 → 100644
View file @
da596da1
File added
widget_aguandhischipmunks/announcement_board/admin.py
View file @
da596da1
from
django.contrib
import
admin
from
django.contrib
import
admin
from
.models
import
Announcement
,
Reaction
from
.models
import
Announcement
,
Reaction
class
ReactionInline
(
admin
.
TabularInline
):
class
ReactionInline
(
admin
.
TabularInline
):
model
=
Reaction
model
=
Reaction
# admin panel for Announcemnet model
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
class
AnnouncementAdmin
(
admin
.
ModelAdmin
):
model
=
Announcement
model
=
Announcement
...
@@ -12,13 +14,13 @@ class AnnouncementAdmin(admin.ModelAdmin):
...
@@ -12,13 +14,13 @@ class AnnouncementAdmin(admin.ModelAdmin):
list_filter
=
(
'title'
,
'author'
,
'pub_datetime'
,)
list_filter
=
(
'title'
,
'author'
,
'pub_datetime'
,)
inlines
=
[
ReactionInline
,]
inlines
=
[
ReactionInline
,]
# admin panel for Reaction model
class
ReactionAdmin
(
admin
.
ModelAdmin
):
class
ReactionAdmin
(
admin
.
ModelAdmin
):
model
=
Reaction
model
=
Reaction
search_fields
=
(
'name'
,
'announcement'
,)
search_fields
=
(
'name'
,
'announcement'
,)
list_display
=
(
'name'
,
'tally'
,
'announcement'
,)
list_display
=
(
'name'
,
'tally'
,
'announcement'
,)
list_filter
=
(
'name'
,
'tally'
,)
list_filter
=
(
'name'
,
'tally'
,)
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
admin
.
site
.
register
(
Announcement
,
AnnouncementAdmin
)
admin
.
site
.
register
(
Reaction
,
ReactionAdmin
)
admin
.
site
.
register
(
Reaction
,
ReactionAdmin
)
widget_aguandhischipmunks/announcement_board/models.py
View file @
da596da1
from
django.db
import
models
from
django.db
import
models
from
dashboard.models
import
WidgetUser
from
dashboard.models
import
WidgetUser
# Announcement
# title; body; author; pub_datetime
class
Announcement
(
models
.
Model
):
class
Announcement
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
title
=
models
.
CharField
(
max_length
=
50
)
body
=
models
.
TextField
(
max_length
=
420
)
body
=
models
.
TextField
(
max_length
=
420
)
...
@@ -10,6 +12,9 @@ class Announcement(models.Model):
...
@@ -10,6 +12,9 @@ class Announcement(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
# Reaction
# name; tally; announcement;
class
Reaction
(
models
.
Model
):
class
Reaction
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
name
=
models
.
CharField
(
max_length
=
100
)
tally
=
models
.
IntegerField
(
default
=
0
)
tally
=
models
.
IntegerField
(
default
=
0
)
...
...
widget_aguandhischipmunks/announcement_board/urls.py
View file @
da596da1
#announcements/urls.py
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
urlpatterns
=
[
# url for announcement
urlpatterns
=
[
path
(
""
,
views
.
announcement_boardIndex
,
name
=
"announcement_boardIndex"
)
path
(
""
,
views
.
announcement_boardIndex
,
name
=
"announcement_boardIndex"
)
]
]
app_name
=
"announcement_board"
app_name
=
"announcement_board"
\ No newline at end of file
widget_aguandhischipmunks/announcement_board/views.py
View file @
da596da1
...
@@ -2,6 +2,7 @@ from django.http import HttpResponse
...
@@ -2,6 +2,7 @@ from django.http import HttpResponse
from
.models
import
Announcement
,
Reaction
from
.models
import
Announcement
,
Reaction
# announcemnet view from .models
def
announcement_boardIndex
(
request
):
def
announcement_boardIndex
(
request
):
announcements
=
Announcement
.
objects
.
all
()
announcements
=
Announcement
.
objects
.
all
()
reactions
=
Reaction
.
objects
.
all
()
reactions
=
Reaction
.
objects
.
all
()
...
...
widget_aguandhischipmunks/assignments/urls.py
View file @
da596da1
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
# url for homepage
# url for assignments
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'i
ndex'
),
path
(
''
,
views
.
assignmentIndex
,
name
=
'assignmentI
ndex'
),
]
]
\ No newline at end of file
widget_aguandhischipmunks/assignments/views.py
View file @
da596da1
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Assignment
,
Course
from
.models
import
Assignment
# Create your views here.
def
index
(
request
):
# assignment view from .models
def
assignmentIndex
(
request
):
title
=
"Widget's Assignments Page"
+
"<br><br>"
title
=
"Widget's Assignments Page"
+
"<br><br>"
assignments
=
Assignment
.
objects
.
all
()
assignments
=
Assignment
.
objects
.
all
()
# courses = Course.objects.all()
output_view
=
""
output_view
=
""
for
assignment
in
assignments
:
for
assignment
in
assignments
:
name
=
"Assignment Name: "
+
assignment
.
name
+
"<br>"
name
=
"Assignment Name: "
+
assignment
.
name
+
"<br>"
...
...
widget_aguandhischipmunks/calendar_app/models.py
View file @
da596da1
from
django.db
import
models
from
django.db
import
models
from
assignments.models
import
Course
from
assignments.models
import
Course
#Location Choices
#
Location Choices
location_choices
=
[
location_choices
=
[
(
'onsite'
,
'ONSITE'
),
(
'onsite'
,
'ONSITE'
),
(
'online'
,
'ONLINE'
),
(
'online'
,
'ONLINE'
),
...
@@ -11,9 +11,8 @@ location_choices = [
...
@@ -11,9 +11,8 @@ location_choices = [
# Location
# Location
# mode; venue;
# mode; venue;
class
Location
(
models
.
Model
):
class
Location
(
models
.
Model
):
mode
=
models
.
CharField
(
max_length
=
50
,
choices
=
location_choices
,
default
=
'onsite'
)
mode
=
models
.
CharField
(
max_length
=
50
,
choices
=
location_choices
,
default
=
'onsite'
)
venue
=
models
.
TextField
(
max_length
=
50
)
venue
=
models
.
TextField
(
max_length
=
50
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
venue
return
self
.
venue
...
@@ -21,11 +20,11 @@ class Location(models.Model):
...
@@ -21,11 +20,11 @@ class Location(models.Model):
# Event
# Event
# target_datetime; activity; estimated_hours; location; course
# target_datetime; activity; estimated_hours; location; course
class
Event
(
models
.
Model
):
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
(
"Date and Time: "
,
max_length
=
50
)
target_datetime
=
models
.
DateTimeField
(
"Date and Time: "
,
max_length
=
50
)
activity
=
models
.
CharField
(
"Activity: "
,
max_length
=
50
)
activity
=
models
.
CharField
(
"Activity: "
,
max_length
=
50
)
estimated_hours
=
models
.
FloatField
(
"Estimated Hours: "
,
max_length
=
50
)
estimated_hours
=
models
.
FloatField
(
"Estimated Hours: "
,
max_length
=
50
)
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
activity
return
self
.
activity
...
...
widget_aguandhischipmunks/calendar_app/urls.py
View file @
da596da1
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
# url for homepage
# url for calendar
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
calendarIndex
,
name
=
'calendarIndex'
),
path
(
''
,
views
.
calendarIndex
,
name
=
'calendarIndex'
),
]
]
\ No newline at end of file
widget_aguandhischipmunks/calendar_app/views.py
View file @
da596da1
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Event
,
Location
from
.models
import
Event
,
Location
# calendar view from .models
def
calendarIndex
(
request
):
def
calendarIndex
(
request
):
title
=
'Widget’s Calendar of Activities<br><br>'
title
=
'Widget’s Calendar of Activities<br><br>'
events
=
Event
.
objects
.
all
()
events
=
Event
.
objects
.
all
()
...
...
widget_aguandhischipmunks/dashboard/models.py
View file @
da596da1
from
django.db
import
models
from
django.db
import
models
# Created Department model
# Department
# dept_name; home_unit
class
Department
(
models
.
Model
):
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
100
)
dept_name
=
models
.
CharField
(
max_length
=
100
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
home_unit
=
models
.
CharField
(
max_length
=
100
)
...
@@ -10,7 +11,8 @@ class Department(models.Model):
...
@@ -10,7 +11,8 @@ class Department(models.Model):
# Created WidgetUser model
# WidgetUser
# first_name; middle_name; last_name; department;
class
WidgetUser
(
models
.
Model
):
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
50
)
first_name
=
models
.
CharField
(
max_length
=
50
)
middle_name
=
models
.
CharField
(
max_length
=
50
)
middle_name
=
models
.
CharField
(
max_length
=
50
)
...
...
widget_aguandhischipmunks/dashboard/urls.py
View file @
da596da1
...
@@ -3,9 +3,8 @@
...
@@ -3,9 +3,8 @@
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
# url for dashboard
urlpatterns
=
[
urlpatterns
=
[
path
(
""
,
views
.
dashboardIndex
,
name
=
"dashboardIndex"
)
path
(
""
,
views
.
dashboardIndex
,
name
=
"dashboardIndex"
)
]
]
app_name
=
"dashboard"
app_name
=
"dashboard"
\ No newline at end of file
widget_aguandhischipmunks/dashboard/views.py
View file @
da596da1
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Department
,
WidgetUser
from
.models
import
Department
,
WidgetUser
# dashboard view from .models
def
dashboardIndex
(
request
):
def
dashboardIndex
(
request
):
users
=
WidgetUser
.
objects
.
all
()
users
=
WidgetUser
.
objects
.
all
()
departments
=
Department
.
objects
.
all
()
departments
=
Department
.
objects
.
all
()
...
@@ -11,9 +12,6 @@ def dashboardIndex(request):
...
@@ -11,9 +12,6 @@ def dashboardIndex(request):
home_department
=
str
(
user
.
department
)
home_department
=
str
(
user
.
department
)
dashboard_output
=
dashboard_output
+
username
+
": "
+
home_department
+
"<br>"
dashboard_output
=
dashboard_output
+
username
+
": "
+
home_department
+
"<br>"
return
HttpResponse
(
dashboard_output
)
return
HttpResponse
(
dashboard_output
)
...
...
widget_aguandhischipmunks/forum/admin.py
View file @
da596da1
...
@@ -4,13 +4,13 @@ from .models import ForumPost, Reply
...
@@ -4,13 +4,13 @@ from .models import ForumPost, Reply
class
ReplyInLine
(
admin
.
TabularInline
):
class
ReplyInLine
(
admin
.
TabularInline
):
model
=
Reply
model
=
Reply
# admin panel for Forum model
class
ForumPostAdmin
(
admin
.
ModelAdmin
):
class
ForumPostAdmin
(
admin
.
ModelAdmin
):
model
=
ForumPost
model
=
ForumPost
list_display
=
(
"title"
,
"author"
,
"body"
,
"pub_datetime"
)
list_display
=
(
"title"
,
"author"
,
"body"
,
"pub_datetime"
)
inlines
=
[
ReplyInLine
]
inlines
=
[
ReplyInLine
]
# admin panel for Reply model
class
ReplyAdmin
(
admin
.
ModelAdmin
):
class
ReplyAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
"forum_post"
,
"author"
,
"body"
,
"pub_datetime"
)
list_display
=
(
"forum_post"
,
"author"
,
"body"
,
"pub_datetime"
)
...
...
widget_aguandhischipmunks/forum/models.py
View file @
da596da1
from
django.db
import
models
from
django.db
import
models
from
dashboard.models
import
WidgetUser
from
dashboard.models
import
WidgetUser
# Forum Post
# title; body; author; pub_datetime;
class
ForumPost
(
models
.
Model
):
class
ForumPost
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
title
=
models
.
CharField
(
max_length
=
50
)
body
=
models
.
TextField
(
max_length
=
1000
)
body
=
models
.
TextField
(
max_length
=
1000
)
...
@@ -10,7 +12,8 @@ class ForumPost(models.Model):
...
@@ -10,7 +12,8 @@ class ForumPost(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
title
return
self
.
title
# Reply
# body; author; pub_datetime; forum_post;
class
Reply
(
models
.
Model
):
class
Reply
(
models
.
Model
):
body
=
models
.
CharField
(
max_length
=
1000
)
body
=
models
.
CharField
(
max_length
=
1000
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
...
...
widget_aguandhischipmunks/forum/urls.py
View file @
da596da1
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
# url for forum
urlpatterns
=
[
urlpatterns
=
[
path
(
""
,
views
.
forumIndex
,
name
=
"forumIndex"
),
path
(
""
,
views
.
forumIndex
,
name
=
"forumIndex"
),
]
]
\ No newline at end of file
widget_aguandhischipmunks/forum/views.py
View file @
da596da1
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
ForumPost
,
Reply
from
.models
import
ForumPost
,
Reply
# forum view from .models
def
forumIndex
(
request
):
def
forumIndex
(
request
):
# fetch forum posts and replies
# fetch forum posts and replies
...
...
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