Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_robo_mommy
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Raul Jarod Conanan
midterm_robo_mommy
Commits
3bbae7af
Commit
3bbae7af
authored
May 14, 2023
by
Lance Dominic B. Santuyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated FBV implementation to use template
parent
14ed12cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
34 deletions
+6
-34
views.py
widget_robo_mommy/widget_Calendar/views.py
+6
-34
No files found.
widget_robo_mommy/widget_Calendar/views.py
View file @
3bbae7af
from
django.shortcuts
import
render
from
.models
import
Event
from
django.http
import
HttpResponse
from
forum.views
import
convert_utc_to_local
...
...
@@ -6,40 +7,11 @@ from django.urls import reverse
def
index
(
request
):
html_string
=
'''
<title>robo_mommy’s Calendar of Activities</title>
<h2>robo_mommy’s Calendar of Activities</h2><ul>
'''
for
eventItem
in
Event
.
objects
.
all
():
eventId
=
str
(
eventItem
.
pk
)
href
=
'<a href="widget_Calendar/Events/'
+
eventId
+
'/details">'
html_string
+=
'''
<br><li> {}
Date and Time: {}<br>
Activity: {}<br>
Estimated Hours: {}<br>
Course/Section: {}<br>
Mode: {}<br>
Venue: {}<br>
</li><br>
'''
.
format
(
href
,
convert_utc_to_local
(
eventItem
.
target_datetime
,
'
%
d/
%
m/
%
Y|
%
I:
%
M
%
p'
),
eventItem
.
activity
,
eventItem
.
estimated_hours
,
eventItem
.
course
.
code
,
eventItem
.
location
.
mode
,
eventItem
.
location
.
venue
,
)
html_string
+=
'''
</ul>
<a href="widget_Calendar/Events/add"><button value="click here">New Activity</button></a><br><br>
<a href="/dashboard/">dashboard</a><br>
<a href="/announcements/">Announcements</a><br>
<a href="/forum/">Forum</a><br>
<a href="/assignments">Assignments</a><br>
'''
return
HttpResponse
(
html_string
)
events
=
Event
.
objects
.
all
()
context
=
{
'events'
:
events
}
return
render
(
request
,
'widget_Calendar/calendar.html'
,
context
)
class
EventDetailView
(
generic
.
DetailView
):
...
...
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