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
d94ef6f3
Commit
d94ef6f3
authored
May 20, 2022
by
Rau Layug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Completed calendarapp Final Project
parent
8f91c608
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
11 deletions
+19
-11
urls.cpython-39.pyc
widget_group_25/calendarapp/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
widget_group_25/calendarapp/__pycache__/views.cpython-39.pyc
+0
-0
urls.py
widget_group_25/calendarapp/urls.py
+2
-2
views.py
widget_group_25/calendarapp/views.py
+8
-7
db.sqlite3
widget_group_25/db.sqlite3
+0
-0
styles.css
...roup_25/widget_group_25/static/calendarapp/css/styles.css
+5
-0
add_event.html
...p_25/widget_group_25/templates/calendarapp/add_event.html
+4
-2
No files found.
widget_group_25/calendarapp/__pycache__/urls.cpython-39.pyc
View file @
d94ef6f3
No preview for this file type
widget_group_25/calendarapp/__pycache__/views.cpython-39.pyc
View file @
d94ef6f3
No preview for this file type
widget_group_25/calendarapp/urls.py
View file @
d94ef6f3
from
django.urls
import
path
from
.
import
views
from
.
views
import
CalendarView
urlpatterns
=
[
path
(
''
,
views
.
calendar
,
name
=
'calendar'
)
path
(
''
,
CalendarView
.
as_view
()
,
name
=
'calendar'
)
]
app_name
=
"calendar"
widget_group_25/calendarapp/views.py
View file @
d94ef6f3
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
django.
core.files.storage
import
FileSystemStorage
from
django.
views
import
View
from
.models
import
Event
,
Location
from
.forms
import
EventForm
...
...
@@ -8,14 +8,15 @@ from assignments.models import Course
# Create your views here.
class
CalendarView
(
View
):
def
get
(
self
,
request
):
return
render
(
request
,
'calendarapp/calendar.html'
,
{
'Courses'
:
Course
.
objects
.
all
()
.
order_by
(
'course_code'
),
'Events'
:
Event
.
objects
.
all
()
.
order_by
(
'target_date'
)})
def
add_event
(
request
):
if
request
.
method
==
'POST'
:
form
=
EventForm
(
request
.
POST
,
request
.
FILES
)
if
form
.
is_valid
():
# upload = request.FILES['upload']
# fss = FileSystemStorage()
# file = fss.save(upload.name, upload)
# file_url = fss.url(file)
new_location
=
Location
(
mode
=
form
.
cleaned_data
.
get
(
'mode'
),
venue
=
form
.
cleaned_data
.
get
(
'venue'
),
image
=
form
.
cleaned_data
.
get
(
'image'
))
new_location
.
save
()
new_event
=
Event
(
target_date
=
form
.
cleaned_data
.
get
(
'target_date'
),
activity
=
form
.
cleaned_data
.
get
(
'activity'
),
estimated_hours
=
form
.
cleaned_data
.
get
(
'estimated_hours'
),
course
=
form
.
cleaned_data
.
get
(
'course'
),
location
=
new_location
)
...
...
@@ -27,8 +28,8 @@ def add_event(request):
return
render
(
request
,
'calendarapp/add_event.html'
,
{
'form'
:
form
})
def
calendar
(
request
):
return
render
(
request
,
'calendarapp/calendar.html'
,
{
'Courses'
:
Course
.
objects
.
all
()
.
order_by
(
'course_code'
),
'Events'
:
Event
.
objects
.
all
()
.
order_by
(
'target_date'
)})
#
def calendar(request):
#
return render(request, 'calendarapp/calendar.html', {'Courses': Course.objects.all().order_by('course_code'), 'Events': Event.objects.all().order_by('target_date')})
def
events
(
request
,
id
):
...
...
widget_group_25/db.sqlite3
View file @
d94ef6f3
No preview for this file type
widget_group_25/widget_group_25/static/calendarapp/css/styles.css
View file @
d94ef6f3
...
...
@@ -52,6 +52,11 @@ img {
display
:
block
;
}
input
{
font-family
:
'Roboto'
,
sans-serif
;
font-size
:
1rem
;
}
ul
{
list-style
:
none
;
}
\ No newline at end of file
widget_group_25/widget_group_25/templates/calendarapp/add_event.html
View file @
d94ef6f3
...
...
@@ -11,8 +11,10 @@
<h1>
New Event
</h1>
<form
method=
"post"
enctype=
"multipart/form-data"
>
{% csrf_token %}
<table>
{{ form }}
<input
type=
"submit"
value=
"Submit"
>
</table>
<input
type=
"submit"
value=
"Save Event"
style=
"font-size: 2rem; margin-left: 8.2rem; background-color: darkseagreen; color: black; border: 0.2rem solid black"
>
</form>
<a
href=
"http://127.0.0.1:8000/calendar"
><button>
Events Page
</button></a>
{% endblock %}
\ 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