Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_casanatics
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
John Aidan Vincent M. Ng
midterm_casanatics
Commits
a05b4c1e
Commit
a05b4c1e
authored
Mar 04, 2023
by
justin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'calendar_wip'
parents
6130be80
4dd9e098
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
120 additions
and
9 deletions
+120
-9
__init__.cpython-310.pyc
...anatics/calendar_app/__pycache__/__init__.cpython-310.pyc
+0
-0
apps.cpython-310.pyc
..._casanatics/calendar_app/__pycache__/apps.cpython-310.pyc
+0
-0
models.cpython-310.pyc
...asanatics/calendar_app/__pycache__/models.cpython-310.pyc
+0
-0
admin.py
widget_casanatics/calendar_app/admin.py
+34
-1
models.py
widget_casanatics/calendar_app/models.py
+26
-0
urls.py
widget_casanatics/calendar_app/urls.py
+9
-0
views.py
widget_casanatics/calendar_app/views.py
+29
-0
views.py
widget_casanatics/dashboard/views.py
+21
-8
__init__.cpython-310.pyc
...cs/widget_casanatics/__pycache__/__init__.cpython-310.pyc
+0
-0
settings.cpython-310.pyc
...cs/widget_casanatics/__pycache__/settings.cpython-310.pyc
+0
-0
urls.py
widget_casanatics/widget_casanatics/urls.py
+1
-0
No files found.
widget_casanatics/calendar_app/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
a05b4c1e
File added
widget_casanatics/calendar_app/__pycache__/apps.cpython-310.pyc
0 → 100644
View file @
a05b4c1e
File added
widget_casanatics/calendar_app/__pycache__/models.cpython-310.pyc
0 → 100644
View file @
a05b4c1e
File added
widget_casanatics/calendar_app/admin.py
View file @
a05b4c1e
from
django.contrib
import
admin
from
.models
import
Location
,
Event
# Register your models here.
class
LocationAdmin
(
admin
.
ModelAdmin
):
model
=
Location
list_display
=
(
"venue"
,
"mode"
,
)
search_fields
=
(
"venue"
,
"mode"
,
)
class
EventAdmin
(
admin
.
ModelAdmin
):
model
=
Event
list_display
=
(
"activity"
,
"target_datetime"
,
"estimated_hours"
,
"location"
,
"course"
,
)
search_fields
=
(
"activity"
,
"location"
,
"course"
,
)
admin
.
site
.
register
(
Location
,
LocationAdmin
)
admin
.
site
.
register
(
Event
,
EventAdmin
)
widget_casanatics/calendar_app/models.py
View file @
a05b4c1e
from
django.db
import
models
from
assignments.models
import
Course
# Create your models here.
class
Location
(
models
.
Model
):
LOCATION_CHOICES
=
[
(
"ONSITE"
,
"Onsite"
),
(
"ONLINE"
,
"Online"
),
(
"HYBRID"
,
"Hybrid"
),
]
mode
=
models
.
CharField
(
max_length
=
6
,
choices
=
LOCATION_CHOICES
,
default
=
"ONSITE"
)
venue
=
models
.
TextField
(
max_length
=
255
)
def
__str__
(
self
):
return
self
.
venue
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
(
"Target Date and Time"
,
)
activity
=
models
.
CharField
(
max_length
=
50
)
estimated_hours
=
models
.
FloatField
()
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
self
.
activity
widget_casanatics/calendar_app/urls.py
0 → 100644
View file @
a05b4c1e
# <appname>/urls.py
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"calendar_app"
\ No newline at end of file
widget_casanatics/calendar_app/views.py
View file @
a05b4c1e
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Event
# Create your views here.
def
index
(
request
):
eventInfo
=
""
events
=
Event
.
objects
.
all
()
for
event
in
events
:
eventInfo
+=
'''
Date and Time: {} <br>
Activity: {} <br>
Estimated Hours: {} <br>
Course/Section: {} {}-{} <br>
Mode: {} <br>
Venue: {} <br>
<br>
'''
.
format
(
event
.
target_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p"
),
event
.
activity
(),
event
.
estimated_hours
(),
event
.
course
.
code
(),
event
.
course
.
title
(),
event
.
course
.
section
(),
event
.
location
.
mode
(),
event
.
location
.
venue
()
)
return
HttpResponse
(
'''
Widget's Calendar of Activities <br>
<br>
{}
'''
.
format
(
eventInfo
))
\ No newline at end of file
widget_casanatics/dashboard/views.py
View file @
a05b4c1e
from
django.http
import
HttpResponse
from
.models
import
Department
,
WidgetUser
from
django.db
import
models
def
dashboard
(
request
):
content
=
"Welcome to Widget! <br><br> WIDGET USERS: <br>"
users
=
WidgetUser
.
objects
.
all
(
)
class
Department
(
models
.
Model
):
dept_name
=
models
.
CharField
(
max_length
=
255
)
home_unit
=
models
.
CharField
(
max_length
=
255
)
for
user
in
users
:
content
+=
str
(
user
)
+
str
(
user
.
department
)
+
"<br>
"
def
__str__
(
self
)
:
return
f
"{self.dept_name}, {self.home_unit}
"
return
HttpResponse
(
content
)
class
WidgetUser
(
models
.
Model
):
first_name
=
models
.
CharField
(
max_length
=
255
)
middle_name
=
models
.
CharField
(
max_length
=
255
)
last_name
=
models
.
CharField
(
max_length
=
255
)
department
=
models
.
ForeignKey
(
Department
,
on_delete
=
models
.
CASCADE
,
)
def
__str__
(
self
):
return
f
"{self.last_name}, {self.first_name} {self.middle_name}"
def
displayName
(
self
):
return
f
"{self.first_name} {self.last_name}"
widget_casanatics/widget_casanatics/__pycache__/__init__.cpython-310.pyc
View file @
a05b4c1e
No preview for this file type
widget_casanatics/widget_casanatics/__pycache__/settings.cpython-310.pyc
View file @
a05b4c1e
No preview for this file type
widget_casanatics/widget_casanatics/urls.py
View file @
a05b4c1e
...
...
@@ -19,4 +19,5 @@ from django.urls import path, include
urlpatterns
=
[
path
(
"admin/"
,
admin
.
site
.
urls
),
path
(
"dashboard/"
,
include
(
"dashboard.urls"
)),
path
(
"calendar/"
,
include
(
"calendar_app.urls"
,
namespace
=
"calendar_app"
)),
]
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