Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_princessgabi
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
Ysabella Panghulan
midterm_princessgabi
Commits
7a7145c0
Commit
7a7145c0
authored
Mar 06, 2023
by
Ysabella Panghulan
Browse files
Options
Browse Files
Download
Plain Diff
Merged widget_calendar branch to main
parents
0eb6540c
1ebdde8c
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
87 additions
and
0 deletions
+87
-0
__init__.py
widget_princessgabi/widget_calendar/__init__.py
+0
-0
admin.py
widget_princessgabi/widget_calendar/admin.py
+18
-0
apps.py
widget_princessgabi/widget_calendar/apps.py
+6
-0
__init__.py
widget_princessgabi/widget_calendar/migrations/__init__.py
+0
-0
models.py
widget_princessgabi/widget_calendar/models.py
+26
-0
tests.py
widget_princessgabi/widget_calendar/tests.py
+3
-0
urls.py
widget_princessgabi/widget_calendar/urls.py
+7
-0
views.py
widget_princessgabi/widget_calendar/views.py
+19
-0
settings.py
widget_princessgabi/widget_princessgabi/settings.py
+4
-0
urls.py
widget_princessgabi/widget_princessgabi/urls.py
+4
-0
No files found.
widget_princessgabi/widget_calendar/__init__.py
0 → 100644
View file @
7a7145c0
widget_princessgabi/widget_calendar/admin.py
0 → 100644
View file @
7a7145c0
from
django.contrib
import
admin
from
.models
import
Event
,
Location
# Register your models here.
class
LocationAdmin
(
admin
.
ModelAdmin
):
model
=
Location
list_display
=
(
'mode'
,
'venue'
,)
search_fields
=
(
'venue'
,)
list_filter
=
(
'mode'
,)
class
EventAdmin
(
admin
.
ModelAdmin
):
model
=
Event
list_display
=
(
'activity'
,
'target_datetime'
,
'estimated_hours'
,
'location'
,
'course'
,)
search_fields
=
(
'activity'
,
'course'
,
'location'
,)
list_filter
=
(
'activity'
,
'target_datetime'
,
'course'
,
'location'
,)
admin
.
site
.
register
(
Location
,
LocationAdmin
)
admin
.
site
.
register
(
Event
,
EventAdmin
)
\ No newline at end of file
widget_princessgabi/widget_calendar/apps.py
0 → 100644
View file @
7a7145c0
from
django.apps
import
AppConfig
class
WidgetCalendarConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'widget_calendar'
widget_princessgabi/widget_calendar/migrations/__init__.py
0 → 100644
View file @
7a7145c0
widget_princessgabi/widget_calendar/models.py
0 → 100644
View file @
7a7145c0
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
=
10
,
choices
=
LOCATION_CHOICES
)
venue
=
models
.
TextField
(
null
=
True
,
blank
=
True
)
def
__str__
(
self
):
return
self
.
venue
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
(
'target date'
)
activity
=
models
.
TextField
()
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
\ No newline at end of file
widget_princessgabi/widget_calendar/tests.py
0 → 100644
View file @
7a7145c0
from
django.test
import
TestCase
# Create your tests here.
widget_princessgabi/widget_calendar/urls.py
0 → 100644
View file @
7a7145c0
from
django.urls
import
path
from
.
import
views
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'calendar'
),
]
\ No newline at end of file
widget_princessgabi/widget_calendar/views.py
0 → 100644
View file @
7a7145c0
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Location
,
Event
# Create your views here.
def
index
(
request
):
events
=
Event
.
objects
.
all
()
welcomeMessage
=
'Widget’
\
s Calendar of Activities <br><br>'
activities
=
''
for
event
in
events
:
activities
+=
'Date and Time: '
+
event
.
target_datetime
.
strftime
(
'
%
m/
%
d/
%
Y,
%
I:
%
M
%
p'
)
+
'<br>'
activities
+=
'Activity: '
+
event
.
activity
+
'<br>'
activities
+=
'Estimated Hours: '
+
str
(
event
.
estimated_hours
)
+
'<br>'
activities
+=
'Course/Section: '
+
event
.
course
.
code
+
' '
+
event
.
course
.
title
+
'-'
+
event
.
course
.
section
+
'<br>'
activities
+=
'Mode: '
+
event
.
location
.
mode
+
'<br>'
activities
+=
'Venue: '
+
event
.
location
.
venue
+
'<br><br>'
return
HttpResponse
(
welcomeMessage
+
activities
)
\ No newline at end of file
widget_princessgabi/widget_princessgabi/settings.py
View file @
7a7145c0
...
...
@@ -35,7 +35,11 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS
=
[
<<<<<<<
HEAD
'dashboard'
,
=======
'widget_calendar.apps.WidgetCalendarConfig'
,
>>>>>>>
widget_calendar
'django.contrib.admin'
,
'django.contrib.auth'
,
'django.contrib.contenttypes'
,
...
...
widget_princessgabi/widget_princessgabi/urls.py
View file @
7a7145c0
...
...
@@ -17,7 +17,11 @@ from django.contrib import admin
from
django.urls
import
include
,
path
urlpatterns
=
[
<<<<<<<
HEAD
path
(
'forum/'
,
include
(
"forum.urls"
,
namespace
=
"forum"
)),
path
(
'dashboard/'
,
include
(
'dashboard.urls'
,
namespace
=
"dashboard"
)),
=======
path
(
'calendar/'
,
include
(
'widget_calendar.urls'
)),
>>>>>>>
widget_calendar
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