Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_nicsbabes
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
Nics De Vega
midterm_nicsbabes
Commits
8dac69ae
Commit
8dac69ae
authored
May 10, 2023
by
Gabriel Geraldo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented new /calendar page
parent
cd772cb6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
36 deletions
+66
-36
models.py
widget_nicsbabes/widget_calendar/models.py
+4
-1
calendar.html
...s/widget_calendar/templates/widget_calendar/calendar.html
+29
-0
event-details.html
...get_calendar/templates/widget_calendar/event-details.html
+22
-0
urls.py
widget_nicsbabes/widget_calendar/urls.py
+3
-2
views.py
widget_nicsbabes/widget_calendar/views.py
+8
-33
No files found.
widget_nicsbabes/widget_calendar/models.py
View file @
8dac69ae
from
django.db
import
models
from
django.db
import
models
from
assignments.models
import
Course
from
assignments.models
import
Course
from
django.urls
import
reverse
class
Location
(
models
.
Model
):
class
Location
(
models
.
Model
):
ONSITE
=
'onsite'
ONSITE
=
'onsite'
...
@@ -38,4 +38,7 @@ class Event(models.Model):
...
@@ -38,4 +38,7 @@ class Event(models.Model):
self
.
activity
,
self
.
activity
,
self
.
course
self
.
course
)
)
def
get_absolute_url
(
self
):
return
reverse
(
"widget_calendar:event_details"
,
kwargs
=
{
"pk"
:
self
.
pk
})
\ No newline at end of file
widget_nicsbabes/widget_calendar/templates/widget_calendar/calendar.html
0 → 100644
View file @
8dac69ae
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget's Calendar of Activities{% endblock title %}
{% block content %}
<h1>
Widget's Calendar of Activities
</h1>
{% for event in events %}
<p><strong>
<a
href=
"{{ event.get_absolute_url }}"
>
<li>
{{ event.activity }}
</li>
</a>
</strong></p>
{% endfor %}
<form
action=
"events/add"
>
<input
type=
"submit"
value=
"Add Activity"
>
</form>
<div>
<a
href=
"../dashboard/"
>
Dashboard
</a><br>
<a
href=
"../announcements/"
>
Announcements
</a><br>
<a
href=
"../forum/"
>
Forum
</a><br>
<a
href=
"../assignments/"
>
Assignments
</a><br>
</div>
{% endblock content %}
\ No newline at end of file
widget_nicsbabes/widget_calendar/templates/widget_calendar/event-details.html
0 → 100644
View file @
8dac69ae
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.activity }}{% endblock %}
{% block content %}
<div
style=
"text-transform:uppercase;"
>
<h1>
{{ object.activity }}
</h1>
</div>
<h2>
Date and Time: {{ object.get_date }}, {{ object.get_time }}
<br>
Estimated Hours: {{ object.estimated_hours }}
<br>
{{ object.course.code }} {{ object.course.title }} - {{ object.course.section }}
<br>
Mode: {{ object.location.mode }}
<br>
Venue: {{ object.location.venue }}
</h2>
<form
action=
"../edit/"
>
<input
type=
"submit"
value=
"Edit Activity"
>
</form>
{% endblock %}
widget_nicsbabes/widget_calendar/urls.py
View file @
8dac69ae
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
index
,
EventDetailView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
)
path
(
''
,
index
,
name
=
'index'
),
path
(
'events/<int:pk>/details'
,
EventDetailView
.
as_view
(),
name
=
'event_details'
),
]
]
app_name
=
"widget_calendar"
app_name
=
"widget_calendar"
\ No newline at end of file
widget_nicsbabes/widget_calendar/views.py
View file @
8dac69ae
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Event
,
Location
from
.models
import
Event
,
Location
from
django.views.generic.detail
import
DetailView
def
index
(
HttpRequest
):
def
index
(
HttpRequest
):
html_output
=
'''
events
=
Event
.
objects
.
all
()
<html>
args
=
{
'events'
:
events
}
<head>
return
render
(
HttpRequest
,
'widget_calendar/calendar.html'
,
args
)
<title>Calendar</title>
</head>
class
EventDetailView
(
DetailView
):
<body>
model
=
Event
<h1>Widget's Calendar of Activities</h1>
template_name
=
"widget_calendar/event-details.html"
'''
\ No newline at end of file
for
event
in
Event
.
objects
.
all
():
html_output
+=
'''
<p>
Date and Time: {}<br>
Activity: {}<br>
Estimated Hours: {}<br>
Course/Section: {} {}-{}<br>
Mode: {}<br>
Venue: {}<br>
</p>
'''
.
format
(
event
.
target_datetime
.
strftime
(
"
%
m/
%
d/
%
Y,
%
I:
%
M
%
p"
),
event
.
activity
,
event
.
estimated_hours
,
event
.
course
,
event
.
course
.
title
,
event
.
course
.
section
,
event
.
location
.
mode
,
event
.
location
.
venue
)
html_output
+=
'''
</body>
</html>
'''
return
HttpResponse
(
html_output
)
\ 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