Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 25
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
Andre Matthew Dumandan
widget_group 25
Commits
c9687cbf
Commit
c9687cbf
authored
Apr 01, 2022
by
Rau Layug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated calendarapp views for Location model
parent
975880ff
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
15 deletions
+15
-15
models.cpython-39.pyc
...et_group_25/calendarapp/__pycache__/models.cpython-39.pyc
+0
-0
views.cpython-39.pyc
widget_group_25/calendarapp/__pycache__/views.cpython-39.pyc
+0
-0
models.py
widget_group_25/calendarapp/models.py
+5
-13
views.py
widget_group_25/calendarapp/views.py
+10
-2
No files found.
widget_group_25/calendarapp/__pycache__/models.cpython-39.pyc
View file @
c9687cbf
No preview for this file type
widget_group_25/calendarapp/__pycache__/views.cpython-39.pyc
View file @
c9687cbf
No preview for this file type
widget_group_25/calendarapp/models.py
View file @
c9687cbf
...
...
@@ -8,9 +8,12 @@ class Location(models.Model):
(
"ONL"
,
"Online"
),
(
"OAO"
,
"Onsite and Online"
)
]
mode
=
models
.
CharField
(
max_length
=
3
,
choices
=
MODE_CHOICES
)
mode
=
models
.
CharField
(
max_length
=
18
,
choices
=
MODE_CHOICES
)
venue
=
models
.
CharField
(
max_length
=
150
)
def
__str__
(
self
):
return
self
.
venue
class
Event
(
models
.
Model
):
target_date
=
models
.
DateField
()
...
...
@@ -21,15 +24,4 @@ class Event(models.Model):
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
def
__str__
(
self
):
return
'{} with {} hours duration on {} '
.
format
(
self
.
activity
,
self
.
estimated_hours
,
self
.
target_date
)
def
get_display
(
self
):
display
=
(
"Target Date: "
+
str
(
self
.
target_date
)
+
"<br>"
+
"Activity: "
+
str
(
self
.
activity
)
+
"<br>"
+
"Estimated Hours: "
+
str
(
self
.
estimated_hours
)
+
"<br>"
+
"Course/Section: "
+
'" ".join(str(self.course.course_code),str(self.course.course_title),str(self.course.section))'
+
"<br>"
+
"Mode: "
+
str
(
self
.
location
)
+
"<br>"
+
"Venue: "
+
str
(
self
.
location
)
+
"<br>"
)
return
display
return
self
.
activity
widget_group_25/calendarapp/views.py
View file @
c9687cbf
...
...
@@ -7,10 +7,18 @@ from .models import Event, Location
# Create your views here.
def
index
(
request
):
response
=
"This is the Calendar page!<br><br>"
events
=
Event
.
objects
.
all
()
for
event
in
events
:
response
+=
event
.
get_display
()
+
"<br>"
location
=
event
.
location
target_date
=
event
.
target_date
activity
=
event
.
activity
estimated_hours
=
event
.
estimated_hours
course_section
=
"foo"
mode
=
location
.
get_mode_display
()
venue
=
location
.
venue
response
+=
"Target Date: {}<br>Activity: {}<br>Estimated Hours: {}<br>Course/Section: {}<br>Mode: {}<br>Venue: {}<br><br>"
.
format
(
target_date
,
activity
,
estimated_hours
,
course_section
,
mode
,
venue
)
return
HttpResponse
(
response
)
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