Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm-group3
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
John Michael T. Amador
midterm-group3
Commits
394d4c4c
Commit
394d4c4c
authored
May 15, 2023
by
Marco Anton O. Paeldon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'calendarv2'
parents
c0136a8f
1bd9dab5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
141 additions
and
47 deletions
+141
-47
README.md
README.md
+7
-5
models.py
widget_group3/Assignments/models.py
+1
-1
models.py
widget_group3/calendar_app/models.py
+4
-2
calendar.html
..._group3/calendar_app/templates/calendar_app/calendar.html
+24
-0
event-add.html
...group3/calendar_app/templates/calendar_app/event-add.html
+24
-0
event-details.html
...p3/calendar_app/templates/calendar_app/event-details.html
+15
-0
event-edit.html
...roup3/calendar_app/templates/calendar_app/event-edit.html
+24
-0
urls.py
widget_group3/calendar_app/urls.py
+6
-2
views.py
widget_group3/calendar_app/views.py
+26
-28
base.html
widget_group3/templates/base.html
+7
-7
settings.py
widget_group3/widget_group3/settings.py
+3
-2
No files found.
README.md
View file @
394d4c4c
...
@@ -11,7 +11,7 @@ Paeldon, Marco Anton O. 193752
...
@@ -11,7 +11,7 @@ Paeldon, Marco Anton O. 193752
Rodillas, Ron Lawrence C. 204364
Rodillas, Ron Lawrence C. 204364
# project title;
# project title;
Widget v
1
Widget v
2
# members’ app assignments;
# members’ app assignments;
Amador - Assignments App
Amador - Assignments App
...
@@ -20,25 +20,27 @@ Fausto - Dashboard App
...
@@ -20,25 +20,27 @@ Fausto - Dashboard App
Paeldon- Announcements App
Paeldon- Announcements App
Rodillas - Forum App
Rodillas - Forum App
# date of submission;
# date of submission;
15 May 2023
# a statement, in your group’s own words, that the project was truthfully completed by your group;
# a statement, in your group’s own words, that the project was truthfully completed by your group;
This project was accomplished truthfully only by the people whose names are listed above.
This project was accomplished truthfully only by the people whose names are listed above.
# list of references used;
# list of references used;
Queries - Django Documentation
https://docs.djangoproject.com/en/4.1/topics/db/queries/#retrieving-a-single-object-with-get
<<<<<<< HEAD
Datetime Import
Datetime Import
https://docs.python.org/3/library/datetime.html
https://docs.python.org/3/library/datetime.html
Button as Link
Button as Link
https://stackoverflow.com/questions/2906582/how-do-i-create-an-html-button-that-acts-like-a-link
https://stackoverflow.com/questions/2906582/how-do-i-create-an-html-button-that-acts-like-a-link
=======
>>>>>>> calendarv2
# members’ signatures in the form (sgd) your complete name, date
# members’ signatures in the form (sgd) your complete name, date
John Michael T. Amador (sgd) February 28, 2023
John Michael T. Amador (sgd) February 28, 2023
Alvin Joshua M. Andrada (sgd) Ma
rch 2
, 2023
Alvin Joshua M. Andrada (sgd) Ma
y 14
, 2023
Brendan Gabrielle M. Fausto (sgd) March 6, 2023
Brendan Gabrielle M. Fausto (sgd) March 6, 2023
Marco Anton O. Paeldon (sgd) March 6, 2023
Marco Anton O. Paeldon (sgd) March 6, 2023
Ron Lawrence C. Rodillas (sgd) March 5, 2023
Ron Lawrence C. Rodillas (sgd) March 5, 2023
widget_group3/Assignments/models.py
View file @
394d4c4c
...
@@ -9,7 +9,7 @@ class Course(models.Model):
...
@@ -9,7 +9,7 @@ class Course(models.Model):
section
=
models
.
CharField
(
max_length
=
3
)
section
=
models
.
CharField
(
max_length
=
3
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'{}
{} {}'
.
format
(
self
.
code
,
self
.
titl
e
,
self
.
section
)
return
'{}
-{}'
.
format
(
self
.
cod
e
,
self
.
section
)
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'course_detail'
,
args
=
[
str
(
self
.
section
)])
return
reverse
(
'course_detail'
,
args
=
[
str
(
self
.
section
)])
...
...
widget_group3/calendar_app/models.py
View file @
394d4c4c
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
Event
(
models
.
Model
):
class
Event
(
models
.
Model
):
target_datetime
=
models
.
DateTimeField
()
activity
=
models
.
CharField
(
max_length
=
100
)
activity
=
models
.
CharField
(
max_length
=
100
)
target_datetime
=
models
.
DateTimeField
()
estimated_hours
=
models
.
FloatField
()
estimated_hours
=
models
.
FloatField
()
location
=
models
.
ForeignKey
(
location
=
models
.
ForeignKey
(
'Location'
,
'Location'
,
...
@@ -16,6 +17,7 @@ class Event(models.Model):
...
@@ -16,6 +17,7 @@ class Event(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
'{} on {}'
.
format
(
self
.
activity
,
self
.
target_datetime
)
return
'{} on {}'
.
format
(
self
.
activity
,
self
.
target_datetime
)
class
Location
(
models
.
Model
):
class
Location
(
models
.
Model
):
mode_choices
=
[
mode_choices
=
[
...
@@ -31,5 +33,5 @@ class Location(models.Model):
...
@@ -31,5 +33,5 @@ class Location(models.Model):
venue
=
models
.
CharField
(
max_length
=
200
)
venue
=
models
.
CharField
(
max_length
=
200
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
venue
return
'{} - {}'
.
format
(
self
.
mode
,
self
.
venue
)
widget_group3/calendar_app/templates/calendar_app/calendar.html
0 → 100644
View file @
394d4c4c
<!-- calendar html -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Widget's Calendar of Activities{% endblock %}
{% block content %}
<h1>
Widget's Calendar of Activities
</h1>
{%for object in event%}
<a
href=
"{% url 'calendar_app:event-details' object.id %}"
>
{{ object.activity }}
</a>
<br>
{%endfor%}
<br>
<a
href=
"{% url 'calendar_app:event-add'%}"
><button>
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>
{% endblock %}
widget_group3/calendar_app/templates/calendar_app/event-add.html
0 → 100644
View file @
394d4c4c
<!-- event add -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Add Activity{% endblock %}
{% block content %}
{{ form.non_field_errors }}
{% for field in form %}
{% if field.errors %}
<p>
{{ field.label }} has the following errors:
</p>
<ul>
{% for error in field.errors %}
<li>
{{ error }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
Add a new activity:
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save New Activity"
>
</form>
{% endblock %}
\ No newline at end of file
widget_group3/calendar_app/templates/calendar_app/event-details.html
0 → 100644
View file @
394d4c4c
<!-- event details -->
{% extends 'base.html' %}
{% block title %} {{object.activity}} {% endblock %}
{% block content %}
<h1>
{{ object.activity }}
</h1>
<h3>
Date and Time: {{ object.target_datetime | date:"m/d/Y, h:i A" }}
</h3>
<h3>
Estimated Hours: {{ object.estimated_hours }}
</h3>
<h3>
{{ object.course.code }} {{ object.course.title }} - {{ object.course.section }}
</h3>
<h3>
Mode: {{ object.location.mode }}
</h3>
<h3>
Venue: {{ object.location.venue }}
</h3>
<a
href=
"{% url 'calendar_app:event-edit' object.id %}"
><button>
Edit Activity
</button></a>
{% endblock %}
widget_group3/calendar_app/templates/calendar_app/event-edit.html
0 → 100644
View file @
394d4c4c
<!-- event-edit -->
{% extends 'base.html' %}
{% load static %}
{% block title %}Edit Activity{% endblock %}
{% block content %}
{{ form.non_field_errors }}
{% for field in form %}
{% if field.errors %}
<p>
{{ field.label }} has the following errors:
</p>
<ul>
{% for error in field.errors %}
<li>
{{ error }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
Edit activity:
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save New Activity"
>
</form>
{% endblock %}
\ No newline at end of file
widget_group3/calendar_app/urls.py
View file @
394d4c4c
...
@@ -2,10 +2,14 @@
...
@@ -2,10 +2,14 @@
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
from
.views
import
event_view
,
EventDetailView
,
EventCreateView
,
EventUpdateView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
event_view
,
name
=
'event_view'
),
path
(
'events/<int:pk>/details/'
,
EventDetailView
.
as_view
(),
name
=
'event-details'
),
path
(
'events/add'
,
EventCreateView
.
as_view
(),
name
=
'event-add'
),
path
(
'events/<int:pk>/edit'
,
EventUpdateView
.
as_view
(),
name
=
'event-edit'
),
]
]
app_name
=
"calendar_app"
app_name
=
"calendar_app"
widget_group3/calendar_app/views.py
View file @
394d4c4c
...
@@ -8,35 +8,33 @@
...
@@ -8,35 +8,33 @@
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
import
CreateView
,
UpdateView
from
django.views.generic.detail
import
DetailView
from
django.urls
import
reverse
import
datetime
import
datetime
def
event_view
(
request
):
event
=
Event
.
objects
.
all
()
return
render
(
request
,
'calendar_app/calendar.html'
,
{
'event'
:
event
})
def
index
(
request
):
class
EventDetailView
(
DetailView
):
total_objects
=
Event
.
objects
.
count
()
model
=
Event
page_format
=
"Widget's Calendar of Activities <br>"
template_name
=
'calendar_app/event-details.html'
#displays the details for each events
class
EventCreateView
(
CreateView
):
for
i
in
range
(
1
,
total_objects
+
1
):
model
=
Event
page_format
+=
'<br>'
+
display_details
(
i
)
fields
=
'__all__'
return
HttpResponse
(
page_format
)
template_name
=
'calendar_app/event-add.html'
def
display_details
(
index
):
#after creating form, sends user to detail page of created activity
#gets all the object's attributes
def
get_success_url
(
self
):
event
=
Event
.
objects
.
get
(
pk
=
index
)
return
reverse
(
'calendar_app:event-details'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
})
date
=
event
.
target_datetime
.
date
()
.
strftime
(
"
%
m/
%
d/
%
Y"
)
time
=
event
.
target_datetime
.
time
()
.
strftime
(
"
%
I:
%
M
%
p"
)
class
EventUpdateView
(
UpdateView
):
activity
=
event
.
activity
model
=
Event
estimated_hours
=
event
.
estimated_hours
fields
=
'__all__'
course_code
=
event
.
course
.
code
template_name
=
'calendar_app/event-edit.html'
course_title
=
event
.
course
.
title
section
=
event
.
course
.
section
mode
=
event
.
location
.
mode
venue
=
event
.
location
.
venue
#arrange all the details
#after updating form, sends user to detail page of created activity
display
=
'Date and Time: {}, {} <br>'
.
format
(
date
,
time
)
def
get_success_url
(
self
):
display
+=
'Activity: {} <br>'
.
format
(
activity
)
return
reverse
(
'calendar_app:event-details'
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
})
display
+=
'Estimated Hours {} <br>'
.
format
(
estimated_hours
)
display
+=
'Course/Section: {} {}-{} <br>'
.
format
(
course_code
,
course_title
,
section
)
display
+=
'Mode: {} <br>'
.
format
(
mode
)
display
+=
'Venue: {} <br>'
.
format
(
venue
)
return
display
\ No newline at end of file
widget_group3/templates/base.html
View file @
394d4c4c
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
<link
rel=
"stylesheet"
href=
"style.css"
>
<link
rel=
"stylesheet"
href=
"style.css"
>
<title>
{% block title %}My amazing site
{% endblock %}
</title>
<title>
{% block title %}
{% endblock %}
</title>
{% block styles %}{% endblock %}
{% block styles %}{% endblock %}
</head>
</head>
<body>
<body>
<div
id=
"content"
>
<div
id=
"content"
>
{% block content %}{% endblock %}
{% block content %}{% endblock %}
</div>
</div>
{% block scripts %}{% endblock %}
</body>
</body>
</html>
</html>
widget_group3/widget_group3/settings.py
View file @
394d4c4c
...
@@ -10,8 +10,9 @@ For the full list of settings and their values, see
...
@@ -10,8 +10,9 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
"""
from
pathlib
import
Path
import
os
from
pathlib
import
Path
,
os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR
=
Path
(
__file__
)
.
resolve
()
.
parent
.
parent
BASE_DIR
=
Path
(
__file__
)
.
resolve
()
.
parent
.
parent
...
...
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