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
84ea923c
Commit
84ea923c
authored
Mar 05, 2023
by
Christian Louis Olivares
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'calendar'
parents
6a0dc18f
7167608d
Changes
22
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
143 additions
and
1 deletion
+143
-1
README.txt
README.txt
+1
-1
settings.py
widget_gitgud/widget_gitgud/settings.py
+1
-0
urls.py
widget_gitgud/widget_gitgud/urls.py
+1
-0
__init__.py
widget_gitgud/widgetcalendar/__init__.py
+0
-0
__init__.cpython-310.pyc
...itgud/widgetcalendar/__pycache__/__init__.cpython-310.pyc
+0
-0
admin.cpython-310.pyc
...t_gitgud/widgetcalendar/__pycache__/admin.cpython-310.pyc
+0
-0
apps.cpython-310.pyc
...et_gitgud/widgetcalendar/__pycache__/apps.cpython-310.pyc
+0
-0
models.cpython-310.pyc
..._gitgud/widgetcalendar/__pycache__/models.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...et_gitgud/widgetcalendar/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
...t_gitgud/widgetcalendar/__pycache__/views.cpython-310.pyc
+0
-0
admin.py
widget_gitgud/widgetcalendar/admin.py
+15
-0
apps.py
widget_gitgud/widgetcalendar/apps.py
+6
-0
0001_initial.py
widget_gitgud/widgetcalendar/migrations/0001_initial.py
+34
-0
0002_alter_location_venue.py
...ud/widgetcalendar/migrations/0002_alter_location_venue.py
+18
-0
__init__.py
widget_gitgud/widgetcalendar/migrations/__init__.py
+0
-0
0001_initial.cpython-310.pyc
...endar/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
0002_alter_location_venue.cpython-310.pyc
...ons/__pycache__/0002_alter_location_venue.cpython-310.pyc
+0
-0
__init__.cpython-310.pyc
...tcalendar/migrations/__pycache__/__init__.cpython-310.pyc
+0
-0
models.py
widget_gitgud/widgetcalendar/models.py
+45
-0
tests.py
widget_gitgud/widgetcalendar/tests.py
+3
-0
urls.py
widget_gitgud/widgetcalendar/urls.py
+7
-0
views.py
widget_gitgud/widgetcalendar/views.py
+12
-0
No files found.
README.txt
View file @
84ea923c
...
...
@@ -2,7 +2,7 @@ CSCI 40-F
Group Members:
205828 CASTILLO, Gareth Xerxes
GARCIA, Ann Colleen
OLIVARES, Christian Louis
193636
OLIVARES, Christian Louis
204374 RODRIGUEZ, Neal Luigi D.
204655 SEE, Eurydice Gabrielle Madison O.
...
...
widget_gitgud/widget_gitgud/settings.py
View file @
84ea923c
...
...
@@ -41,6 +41,7 @@ INSTALLED_APPS = [
'django.contrib.messages'
,
'django.contrib.staticfiles'
,
'Dashboard'
'widgetcalendar'
]
MIDDLEWARE
=
[
...
...
widget_gitgud/widget_gitgud/urls.py
View file @
84ea923c
...
...
@@ -3,5 +3,6 @@ from django.urls import include, path
urlpatterns
=
[
path
(
'Dashboard/'
,
include
(
'Dashboard.urls'
,
namespace
=
"Dashboard"
)),
path
(
'widgetcalendar/'
,
include
(
'widgetcalendar.urls'
,
namespace
=
"calendar"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
\ No newline at end of file
widget_gitgud/widgetcalendar/__init__.py
0 → 100644
View file @
84ea923c
widget_gitgud/widgetcalendar/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/__pycache__/admin.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/__pycache__/apps.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/__pycache__/models.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/__pycache__/urls.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/__pycache__/views.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/admin.py
0 → 100644
View file @
84ea923c
from
django.contrib
import
admin
from
.models
import
Location
,
Event
class
LocationAdmin
(
admin
.
ModelAdmin
):
model
=
Location
list_display
=
(
'mode'
,
'venue'
)
class
Eventadmin
(
admin
.
ModelAdmin
):
model
=
Event
list_display
=
(
'target_datetime'
,
'activity'
,
'estimated_hours'
,
'location'
,
'course'
)
# registering the model and the admin is what tells
# Django that admin pages must be generated for the models specified
admin
.
site
.
register
(
Location
,
LocationAdmin
)
admin
.
site
.
register
(
Event
,
Eventadmin
)
\ No newline at end of file
widget_gitgud/widgetcalendar/apps.py
0 → 100644
View file @
84ea923c
from
django.apps
import
AppConfig
class
WidgetcalendarConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'widgetcalendar'
widget_gitgud/widgetcalendar/migrations/0001_initial.py
0 → 100644
View file @
84ea923c
# Generated by Django 4.1.7 on 2023-03-02 12:44
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Location'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'mode'
,
models
.
CharField
(
choices
=
[(
'onsite'
,
'onsite'
),
(
'online'
,
'online'
),
(
'hybrid'
,
'hybrid'
)],
max_length
=
6
)),
(
'venue'
,
models
.
CharField
(
default
=
''
,
max_length
=
50
)),
],
),
migrations
.
CreateModel
(
name
=
'Event'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'target_datetime'
,
models
.
DateTimeField
()),
(
'activity'
,
models
.
CharField
(
default
=
''
,
max_length
=
100
)),
(
'estimated_hours'
,
models
.
FloatField
()),
(
'course'
,
models
.
CharField
(
max_length
=
50
)),
(
'location'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'course_name'
,
to
=
'widgetcalendar.location'
)),
],
),
]
widget_gitgud/widgetcalendar/migrations/0002_alter_location_venue.py
0 → 100644
View file @
84ea923c
# Generated by Django 4.1.7 on 2023-03-04 06:35
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'widgetcalendar'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'location'
,
name
=
'venue'
,
field
=
models
.
TextField
(
default
=
''
,
max_length
=
200
),
),
]
widget_gitgud/widgetcalendar/migrations/__init__.py
0 → 100644
View file @
84ea923c
widget_gitgud/widgetcalendar/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/migrations/__pycache__/0002_alter_location_venue.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/migrations/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
84ea923c
File added
widget_gitgud/widgetcalendar/models.py
0 → 100644
View file @
84ea923c
from
django.db
import
models
from
django.urls
import
reverse
#FOR LUIGI: PLS UNCOMMENT WHEN YOU'RE DONE WITH YOUR APPS
#from assignments.models import Course
class
Location
(
models
.
Model
):
MODE_CHOICES
=
(
(
'onsite'
,
'onsite'
),
(
'online'
,
'online'
),
(
'hybrid'
,
'hybrid'
),
)
mode
=
models
.
CharField
(
max_length
=
6
,
choices
=
MODE_CHOICES
)
venue
=
models
.
TextField
(
max_length
=
200
,
default
=
''
)
def
__str__
(
self
):
return
'{}, {} mode'
.
format
(
self
.
venue
,
self
.
mode
)
def
get_absolute_url
(
self
):
return
reverse
(
'location_detail'
,
args
=
[
str
(
self
.
venue
)])
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
()
activity
=
models
.
TextField
(
max_length
=
200
,
default
=
''
)
estimated_hours
=
models
.
FloatField
()
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
,
related_name
=
'course_name'
)
#FOR LUIGI: IF YOU'RE DONE PLS REPLACE THE CURRENT CODE FOR COURSE WITH THE COMMENTED ONE
# course = models.ForeignKey(
# Course,
# on_delete=models.CASCADE,
# related_name='course_name'
# )
course
=
models
.
CharField
(
max_length
=
50
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
activity
)
def
get_absolute_url
(
self
):
return
reverse
(
'event_detail'
,
args
=
[
str
(
self
.
activity
)])
widget_gitgud/widgetcalendar/tests.py
0 → 100644
View file @
84ea923c
from
django.test
import
TestCase
# Create your tests here.
widget_gitgud/widgetcalendar/urls.py
0 → 100644
View file @
84ea923c
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"widgetcalendar"
\ No newline at end of file
widget_gitgud/widgetcalendar/views.py
0 → 100644
View file @
84ea923c
from
django.http
import
HttpResponse
from
.models
import
Event
#Date format source: https://ourcodeworld.com/articles/read/555/how-to-format-datetime-objects-in-the-view-and-template-in-django
def
index
(
request
):
return_string
=
''
for
events
in
Event
.
objects
.
all
():
return_string
+=
'Date and Time: {}<br>Activity: {}<br>Estimated Hours: {}<br>Course/Secion: {}<br>Mode: {}<br>Venue: {}<br></br>'
.
format
(
events
.
target_datetime
.
strftime
(
"
%
x,
%
I:
%
M
%
p"
),
events
.
activity
,
events
.
estimated_hours
,
events
.
course
,
events
.
location
.
mode
,
events
.
location
.
venue
)
html_string
=
'<html><head>Widget
\'
s Calendar of Activities<br></br></head><body>{}</body><html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
\ No newline at end of file
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