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
31f51df3
Commit
31f51df3
authored
May 10, 2023
by
Ciella
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'assignmentsv2'
parents
e04995f1
2dfd98ab
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
235 additions
and
16 deletions
+235
-16
models.py
widget_jenicaesports/assignments/models.py
+12
-2
assignment-add.html
...rts/assignments/templates/assignments/assignment-add.html
+43
-0
assignment-details.html
...assignments/templates/assignments/assignment-details.html
+57
-0
assignment-edit.html
...ts/assignments/templates/assignments/assignment-edit.html
+43
-0
assignments.html
...sports/assignments/templates/assignments/assignments.html
+53
-0
urls.py
widget_jenicaesports/assignments/urls.py
+5
-2
views.py
widget_jenicaesports/assignments/views.py
+22
-12
No files found.
widget_jenicaesports/assignments/models.py
View file @
31f51df3
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
class
Course
(
models
.
Model
):
...
...
@@ -6,8 +7,11 @@ class Course(models.Model):
title
=
models
.
CharField
(
max_length
=
255
)
section
=
models
.
CharField
(
max_length
=
3
)
def
format_course
(
self
):
return
'{} {} - {}'
.
format
(
self
.
code
,
self
.
title
,
self
.
section
)
def
__str__
(
self
):
return
'{}
{}'
.
format
(
self
.
code
,
self
.
section
)
return
'{}
-
{}'
.
format
(
self
.
code
,
self
.
section
)
class
Assignment
(
models
.
Model
):
...
...
@@ -21,5 +25,11 @@ class Assignment(models.Model):
self
.
passing_score
=
int
((
self
.
perfect_score
)
*
(
0.60
))
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
format_assignment
(
self
):
return
'{}'
.
format
(
self
.
name
)
def
__str__
(
self
):
return
'{} {}: {}'
.
format
(
self
.
course
.
code
,
self
.
course
.
section
,
self
.
name
)
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignment-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
widget_jenicaesports/assignments/templates/assignments/assignment-add.html
0 → 100644
View file @
31f51df3
{% extends 'base.html' %}
{% load static %}
{% block title %}
Add Assignment
{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br><br>
<img
src=
"{% static 'assignments_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br><br>
<h2>
Assignments
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Add New Assignment
</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 assignment:
</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 Assignment"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/assignments/templates/assignments/assignment-details.html
0 → 100644
View file @
31f51df3
{% extends 'base.html' %}
{% load static %}
{% block title %}
{{ object }}
{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br>
<br>
<img
src=
"{% static 'assignments_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br>
<br>
<h2>
Assignments
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Assignment 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.name }}
</h1>
</div>
<br>
<div
class=
"row p-2"
style=
"background-color:#e3e4e6"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.course.format_course }}
</h5>
</div>
<br>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Description:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.description }}
</h5>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-5"
style=
"text-align:right"
>
<h4
style=
"font-size:25px"
>
Perfect Score:
</h4>
<h4
style=
"font-size:25px"
>
Passing Score:
</h4>
</div>
<div
class=
"col-7"
style=
"text-align:left"
>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.perfect_score }}
</h5>
<h5
class=
"display-3"
style=
"font-size:25px"
>
{{ object.passing_score }}
</h5>
</div>
</div>
<br><br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#e3e4e6"
>
<a
href=
"/assignments/{{object.pk}}/edit"
class=
"link-dark"
>
Edit Assignment
</a>
</button>
<button
type=
"button"
class=
"btn"
style=
"background-color:#052c65"
>
<a
href=
"/assignments/"
class=
"link-light"
>
[Temp] Back to Calendar
</a>
</button>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/assignments/templates/assignments/assignment-edit.html
0 → 100644
View file @
31f51df3
{% extends 'base.html' %}
{% load static %}
{% block title %}
Edit Assignment
{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br><br>
<img
src=
"{% static 'assignments_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br><br>
<h2>
Assignments
</h2>
<h4
class=
"display-6"
style=
"font-size:20px"
>
Edit Assignment
</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 Assignment
</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 Changes to Assignment"
style=
"background-color:#052c65"
>
</form>
<br><br>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/assignments/templates/assignments/assignments.html
0 → 100644
View file @
31f51df3
{% extends 'base.html' %}
{% load static %}
{% block title %}
Widget's Assignments
{% endblock %}
{% block content %}
<div
class=
"row"
>
<div
class=
"col-3 text-center text-white"
style=
"background-color:#052c65"
>
<br><br>
<img
src=
"{% static 'assignments_icon.png'%}"
class=
"img-fluid"
width=
"100"
height=
"100"
>
<br><br>
<h2>
Assignments
</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 Assignments
</h1>
</div>
<br>
<br>
{% for task in tasks %}
<a
href=
"{{ task.get_absolute_url }}"
class=
"link-dark; display-3"
style=
"font-size:18px; color:#052c65"
>
{{ task.format_assignment }}
</a>
<br>
{% endfor %}
<br><br>
<button
type=
"button"
class=
"btn"
style=
"background-color:#e3e4e6"
>
<a
href=
"/assignments/add/"
class=
"link-dark"
>
New Assignment
</a>
</button>
<br>
<br>
<br>
<div
class=
"text-center"
>
<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"
>
Announcements
</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=
"/calendar/"
class=
"link-light"
>
Calendar
</a>
</button>
</div>
</div>
</div>
{% endblock %}
\ No newline at end of file
widget_jenicaesports/assignments/urls.py
View file @
31f51df3
from
django.urls
import
path
from
.views
import
index
from
.views
import
assignments_view
,
AssignmentDetailView
,
AssignmentCreateView
,
AssignmentUpdateView
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
assignments_view
,
name
=
'assignments'
),
path
(
'<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
path
(
'add/'
,
AssignmentCreateView
.
as_view
(),
name
=
'assignment-add'
),
path
(
'<int:pk>/edit/'
,
AssignmentUpdateView
.
as_view
(),
name
=
'assignment-edit'
),
]
app_name
=
'assignments'
\ No newline at end of file
widget_jenicaesports/assignments/views.py
View file @
31f51df3
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Assignment
# Create your views here.
def
index
(
request
):
return_string
=
'<p>Widget
\'
s Assignments Page<br>'
for
work
in
Assignment
.
objects
.
all
(
):
work_string
=
'<br>Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {}-{}<br>'
.
format
(
work
.
name
,
work
.
description
,
work
.
perfect_score
,
work
.
passing_score
,
work
.
course
.
code
,
work
.
course
.
title
,
work
.
course
.
section
)
return_string
+=
work_string
def
assignments_view
(
request
):
tasks
=
Assignment
.
objects
.
all
()
context
=
{
'tasks'
:
tasks
}
return
render
(
request
,
'assignments/assignments.html'
,
context
)
return_string
+=
'</p>'
html_string
=
'<html><body>{}</body></html>'
.
format
(
return_string
)
return
HttpResponse
(
html_string
)
\ No newline at end of file
class
AssignmentDetailView
(
DetailView
):
model
=
Assignment
template_name
=
'assignments/assignment-details.html'
class
AssignmentCreateView
(
CreateView
):
model
=
Assignment
fields
=
'__all__'
template_name
=
'assignments/assignment-add.html'
class
AssignmentUpdateView
(
UpdateView
):
model
=
Assignment
fields
=
'__all__'
template_name
=
'assignments/assignment-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