Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_tee jays angelos
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
Ramon Angelo Enriquez
widget_tee jays angelos
Commits
a69ffe15
Commit
a69ffe15
authored
May 08, 2022
by
Paul Angelo Sy
Browse files
Options
Browse Files
Download
Plain Diff
Converted Assignments to HTML formatting
parents
800c4172
46151edc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
11 deletions
+35
-11
index.html
...jays_angelos/assignments/templates/assignments/index.html
+16
-0
urls.py
widget_tee_jays_angelos/assignments/urls.py
+2
-1
views.py
widget_tee_jays_angelos/assignments/views.py
+17
-10
No files found.
widget_tee_jays_angelos/assignments/templates/assignments/index.html
0 → 100644
View file @
a69ffe15
<h1>
Assignments Per Course
</h1>
{% if course_list %}
{% for course in course_list %}
<li>
{{course}} {{course.course_title}} {{course.section}}
{% for assignment in assignment_list %}
{% if assignment.course_code == course %}
<ul>
<li>
<a
href=
"/assignments/{{assignment.name}}/"
>
{{assignment.name}}
</a></li>
</ul>
{% endif %}
{% endfor %}
</li>
{% endfor %}
{% else %}
<p>
No assignments are available
</p>
{% endif %}
widget_tee_jays_angelos/assignments/urls.py
View file @
a69ffe15
...
...
@@ -3,5 +3,6 @@ from django.urls import path
from
.
import
views
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"assignments"
)
path
(
''
,
views
.
index
,
name
=
"assignments"
),
path
(
"<str:name>/"
,
views
.
detail
,
name
=
"details"
),
]
widget_tee_jays_angelos/assignments/views.py
View file @
a69ffe15
from
django.http
import
HttpResponse
from
assignments.models
import
Assignment
,
Course
from
django.shortcuts
import
render
from
django.template
import
loader
# Create your views here.
def
index
(
request
):
assignmentOutput
=
"Assignments: <br/><br/>"
for
n
in
Assignment
.
objects
.
all
():
assignmentOutput
+=
(
"Assignment Name: "
+
str
(
n
.
name
)
+
"<br/>"
)
assignmentOutput
+=
(
"Description: "
+
n
.
description
+
"<br/>"
)
assignmentOutput
+=
(
"Perfect Score: "
+
str
(
n
.
max_points
)
+
"<br/>"
)
assignmentOutput
+=
(
"Passing Score: "
+
str
(
n
.
passing_score
)
+
"<br/>"
)
assignmentOutput
+=
(
"Course/Section: "
+
Course
.
objects
.
get
(
course_code
=
n
.
course_code
)
.
course_code
+
" "
)
assignmentOutput
+=
(
Course
.
objects
.
get
(
course_code
=
n
.
course_code
)
.
course_title
+
" "
)
assignmentOutput
+=
(
Course
.
objects
.
get
(
course_code
=
n
.
course_code
)
.
section
+
"<br/><br/>"
)
return
HttpResponse
(
assignmentOutput
)
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
assignment_list
=
Assignment
.
objects
.
all
()
template
=
loader
.
get_template
(
"assignments/index.html"
)
context
=
{
"course_list"
:
course_list
,
"assignment_list"
:
assignment_list
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
detail
(
request
,
name
):
output
=
(
str
(
Assignment
.
objects
.
get
(
name
=
name
)
.
course_code
)
+
" "
)
output
+=
(
str
(
Course
.
objects
.
get
(
course_code
=
Assignment
.
objects
.
get
(
name
=
name
)
.
course_code
)
.
course_title
)
+
" "
)
output
+=
(
str
(
Course
.
objects
.
get
(
course_code
=
Assignment
.
objects
.
get
(
name
=
name
)
.
course_code
)
.
section
)
+
" "
)
return
HttpResponse
(
output
)
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