Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_jenicaesports
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
Christianneil Emmanuel Ocampo
midterm_jenicaesports
Commits
669d7226
Commit
669d7226
authored
May 10, 2023
by
Christianneil Emmanuel Ocampo
Browse files
Options
Browse Files
Download
Plain Diff
Fixed merge conflicts with master
parents
31f51df3
62d075b2
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
291 additions
and
30 deletions
+291
-30
forms.py
widget_jenicaesports/widget_calendar/forms.py
+7
-0
0009_alter_location_mode.py
...ts/widget_calendar/migrations/0009_alter_location_mode.py
+18
-0
0010_alter_location_mode.py
...ts/widget_calendar/migrations/0010_alter_location_mode.py
+18
-0
0011_alter_event_activity.py
...s/widget_calendar/migrations/0011_alter_event_activity.py
+18
-0
models.py
widget_jenicaesports/widget_calendar/models.py
+16
-3
calendar.html
...s/widget_calendar/templates/widget_calendar/calendar.html
+48
-0
event-add.html
.../widget_calendar/templates/widget_calendar/event-add.html
+41
-0
event-details.html
...get_calendar/templates/widget_calendar/event-details.html
+56
-0
event-edit.html
...widget_calendar/templates/widget_calendar/event-edit.html
+41
-0
urls.py
widget_jenicaesports/widget_calendar/urls.py
+7
-2
views.py
widget_jenicaesports/widget_calendar/views.py
+21
-25
No files found.
widget_jenicaesports/widget_calendar/forms.py
0 → 100644
View file @
669d7226
from
django
import
forms
from
.models
import
Event
class
EventForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Event
fields
=
'__all__'
\ No newline at end of file
widget_jenicaesports/widget_calendar/migrations/0009_alter_location_mode.py
0 → 100644
View file @
669d7226
# Generated by Django 4.1.7 on 2023-05-04 09:30
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'widget_calendar'
,
'0008_alter_event_course'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'location'
,
name
=
'mode'
,
field
=
models
.
CharField
(
choices
=
[(
'Onsite'
,
'Onsite'
),
(
'Online'
,
'Online'
),
(
'Hybrid'
,
'Hybrid'
)],
default
=
'Onsite'
,
max_length
=
6
),
),
]
widget_jenicaesports/widget_calendar/migrations/0010_alter_location_mode.py
0 → 100644
View file @
669d7226
# Generated by Django 4.1.7 on 2023-05-04 09:33
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'widget_calendar'
,
'0009_alter_location_mode'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'location'
,
name
=
'mode'
,
field
=
models
.
CharField
(
choices
=
[(
'onsite'
,
'Onsite'
),
(
'online'
,
'Online'
),
(
'hybrid'
,
'Hybrid'
)],
default
=
'onsite'
,
max_length
=
6
),
),
]
widget_jenicaesports/widget_calendar/migrations/0011_alter_event_activity.py
0 → 100644
View file @
669d7226
# Generated by Django 4.1.7 on 2023-05-10 06:28
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'widget_calendar'
,
'0010_alter_location_mode'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'event'
,
name
=
'activity'
,
field
=
models
.
CharField
(
default
=
''
,
max_length
=
255
),
),
]
widget_jenicaesports/widget_calendar/models.py
View file @
669d7226
from
django.db
import
models
from
django.db
import
models
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
assignments
import
models
as
assignments_models
from
assignments
import
models
as
assignments_models
from
django.urls
import
reverse
class
Location
(
models
.
Model
):
class
Location
(
models
.
Model
):
...
@@ -17,11 +18,11 @@ class Location(models.Model):
...
@@ -17,11 +18,11 @@ class Location(models.Model):
venue
=
models
.
TextField
(
default
=
''
)
venue
=
models
.
TextField
(
default
=
''
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{}
({})'
.
format
(
self
.
venue
,
self
.
mod
e
)
return
'{}
- {}'
.
format
(
self
.
mode
,
self
.
venu
e
)
class
Event
(
models
.
Model
):
class
Event
(
models
.
Model
):
activity
=
models
.
CharField
(
default
=
''
,
max_length
=
255
)
target_datetime
=
models
.
DateTimeField
(
default
=
''
)
target_datetime
=
models
.
DateTimeField
(
default
=
''
)
activity
=
models
.
TextField
(
default
=
''
)
estimated_hours
=
models
.
FloatField
(
default
=
''
)
estimated_hours
=
models
.
FloatField
(
default
=
''
)
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
location
=
models
.
ForeignKey
(
Location
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
assignments_models
.
Course
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
assignments_models
.
Course
,
on_delete
=
models
.
CASCADE
)
...
@@ -32,3 +33,15 @@ class Event(models.Model):
...
@@ -32,3 +33,15 @@ class Event(models.Model):
self
.
target_datetime
.
strftime
(
"
%
m/
%
d/
%
y"
),
self
.
target_datetime
.
strftime
(
"
%
m/
%
d/
%
y"
),
self
.
target_datetime
.
strftime
(
"
%
I:
%
M
%
p"
),
self
.
target_datetime
.
strftime
(
"
%
I:
%
M
%
p"
),
)
)
def
formatted_course
(
self
):
return
'{} {}-{}'
.
format
(
self
.
course
.
code
,
self
.
course
.
title
,
self
.
course
.
section
)
def
formatted_date
(
self
):
return
'{}'
.
format
(
self
.
target_datetime
.
strftime
(
"
%
m/
%
d/
%
y"
))
def
formatted_time
(
self
):
return
'{}'
.
format
(
self
.
target_datetime
.
strftime
(
"
%
I:
%
M
%
p"
))
def
get_absolute_url
(
self
):
return
reverse
(
'widget_calendar:event-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
widget_jenicaesports/widget_calendar/templates/widget_calendar/calendar.html
0 → 100644
View file @
669d7226
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget's Calendar of Activities{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'calendar_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Calendar
</h2>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:60px; color:#052c65"
>
Widget's Calendar of Activities
</h1>
</div>
<br>
<br>
{% for object in activities %}
<a
href=
"{{ object.get_absolute_url }}"
class=
"link-dark; display-3"
style=
"font-size:18px; color:#052c65"
>
{{ object.activity }}
</a>
<br>
{% endfor %}
<br><br>
<button
type=
"button"
class=
"btn btn-dark"
style=
"background-color:#e3e4e6"
>
<a
href=
"/calendar/events/add/"
class=
"link-dark"
>
New Activity
</a>
</button>
<br>
<br>
<br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#052c65"
>
<a
href=
"/dashboard/"
class=
"link-light"
>
Dashboard
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#334277"
>
<a
href=
"/announcements/"
class=
"link-light"
>
Announcement Board
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#425086"
>
<a
href=
"/forum/"
class=
"link-light"
>
Forum
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#515e96"
>
<a
href=
"/assignments/"
class=
"link-light"
>
Assignments
</a>
</button>
</div>
</div>
{% endblock %}s
\ No newline at end of file
widget_jenicaesports/widget_calendar/templates/widget_calendar/event-add.html
0 → 100644
View file @
669d7226
{% extends 'base.html' %}
{% load static %}
{% block title %}Add Activity{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'calendar_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Calendar
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Add New Activity
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
Add a new activity:
</h1>
</div>
<br>
<div
class=
"row"
></div>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{field.label}}:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
{{field}}
</div>
</div>
<br>
{% endfor %}
<input
type=
"submit"
class=
"btn btn-dark"
value=
"Save New Activity"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/widget_calendar/templates/widget_calendar/event-details.html
0 → 100644
View file @
669d7226
{% extends 'base.html' %}
{% load static %}
{% block title %}{{ object.activity }}{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'calendar_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Calendar
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Activity Details
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
{{ object.activity }}
</h1>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Date and Time:
</h4>
<h4
style=
"font-size:25px"
>
Estimated Hours:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.formatted_date }}, {{ object.formatted_time }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.estimated_hours }}
</h5>
</div>
</div>
<br>
<div
class=
"row p-2"
style=
"background-color:#e3e4e6"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.formatted_course }}
</h5>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Mode:
</h4>
<h4
style=
"font-size:25px"
>
Venue:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.location.mode }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.location.venue }}
</h5>
</div>
</div>
<br><br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#e3e4e6"
>
<a
href=
"/calendar/events/{{object.pk}}/edit"
class=
"link-dark"
>
Edit Activity
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#052c65"
>
<a
href=
"/calendar/"
class=
"link-light"
>
Back to Calendar
</a>
</button>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/widget_calendar/templates/widget_calendar/event-edit.html
0 → 100644
View file @
669d7226
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Activity{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'calendar_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Calendar
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Edit Activity
</h4>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<p>
© Jenica e-Sports
</p>
</div>
<div
class=
"col-9 text-center"
>
<div
class=
"row p-5 text-center"
style=
"background-color:#e3e4e6"
>
<h1
class=
"display-3"
style=
"font-size:50px; color:#052c65"
>
Edit activity:
</h1>
</div>
<br>
<div
class=
"row"
></div>
<form
method=
"post"
>
{% csrf_token %}
{% for field in form %}
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{field.label}}:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
{{field}}
</div>
</div>
<br>
{% endfor %}
<input
type=
"submit"
class=
"btn btn-dark"
value=
"Save New Activity"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/widget_calendar/urls.py
View file @
669d7226
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
(
calendar
,
EventDetailsView
,
EventsCreateView
,
EventsUpdateView
)
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
calendar
,
name
=
'calendar home'
),
path
(
'events/<pk>/details/'
,
EventDetailsView
.
as_view
(),
name
=
'event-details'
),
path
(
'events/add/'
,
EventsCreateView
.
as_view
(),
name
=
'add-event'
),
path
(
'events/<pk>/edit/'
,
EventsUpdateView
.
as_view
(),
name
=
'update-event'
),
]
]
app_name
=
"widget_calendar"
app_name
=
"widget_calendar"
\ No newline at end of file
widget_jenicaesports/widget_calendar/views.py
View file @
669d7226
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views.generic.detail
import
DetailView
#from django.views.generic.list import ListView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Event
from
.models
import
Event
def
index
(
request
):
def
calendar
(
request
):
return_string
=
'<p>Widget`s Calendar of Activities<br><br>'
activities
=
Event
.
objects
.
all
()
context
=
{
'activities'
:
activities
}
return
render
(
request
,
'widget_calendar/calendar.html'
,
context
)
for
event
in
Event
.
objects
.
all
():
class
EventDetailsView
(
DetailView
):
event_string
=
'''
model
=
Event
Date and Time: {}, {}<br>
template_name
=
'widget_calendar/event-details.html'
Activity: {}<br>
Estimated Hours: {}<br>
Course/Section: {}<br>
Mode: {}<br>
Venue: {}<br>
'''
.
format
(
event
.
target_datetime
.
strftime
(
"
%
m/
%
d/
%
y"
),
event
.
target_datetime
.
strftime
(
"
%
I:
%
M
%
p"
),
event
.
activity
,
event
.
estimated_hours
,
event
.
course
,
event
.
location
.
mode
,
event
.
location
.
venue
)
return_string
+=
event_string
return_string
+=
'</p>'
class
EventsCreateView
(
CreateView
):
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
model
=
Event
fields
=
'__all__'
template_name
=
"widget_calendar/event-add.html"
return
HttpResponse
(
html_string
)
class
EventsUpdateView
(
UpdateView
):
\ No newline at end of file
model
=
Event
fields
=
'__all__'
template_name
=
"widget_calendar/event-edit.html"
\ 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