Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
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
Angelico Ruiz T. Teaño
widget_Alipins
Commits
3f697072
Commit
3f697072
authored
May 09, 2022
by
Angelico Ruiz T. Teaño
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add template and urls for assignments app
parent
a7b37d69
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
19 deletions
+48
-19
index.html
widget_alipins/assignments/templates/assignments/index.html
+31
-0
urls.py
widget_alipins/assignments/urls.py
+2
-1
views.py
widget_alipins/assignments/views.py
+15
-18
No files found.
widget_alipins/assignments/templates/assignments/index.html
0 → 100644
View file @
3f697072
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
Assignments
</title>
</head>
<body>
<h1>
Assignments Per Course
</h1>
<h2>
List of Courses:
</h3>
{% if assignment_list %}
<ul>
{% for course in course_list %}
<li>
{{course.course_code}} | {{course.course_title}} - {{course.section}}
</li>
{% for assignment in assignment_list %}
{% if assignment.course.course_code == course.course_code %}
<ul>
<li><a
href=
"/assignments/{{assignment.id}}/details"
>
{{assignment.name}}
</a></li>
</ul>
{% endif %}
{% endfor %}
<br>
{% endfor %}
</ul>
{% else %}
<p>
There are no assignments under any course.
</p>
{% endif %}
</body>
</html>
\ No newline at end of file
widget_alipins/assignments/urls.py
View file @
3f697072
...
@@ -3,5 +3,6 @@ from django.urls import path
...
@@ -3,5 +3,6 @@ from django.urls import path
from
.
import
views
from
.
import
views
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"indexAssignments"
)
path
(
''
,
views
.
index
,
name
=
"indexAssignments"
),
path
(
'<int:assignment_id>/details'
,
views
.
detail
,
name
=
"detail"
)
]
]
\ No newline at end of file
widget_alipins/assignments/views.py
View file @
3f697072
from
ast
import
Assign
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Assignment
from
django.shortcuts
import
render
from
.models
import
Assignment
,
Course
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
display_output
=
"<u><b>ASSIGNMENTS</u></b>: <br>"
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
assignment_list
=
Assignment
.
objects
.
order_by
(
"name"
)
context
=
{
"assignment_list"
:
assignment_list
,
"course_list"
:
course_list
,
}
for
object
in
Assignment
.
objects
.
all
():
return
render
(
request
,
"assignments/index.html"
,
context
)
display_output
+=
'''
Assignment Name: <b>{name}</b><br>
Description: {description}<br>
Perfect Score: {max_points}<br>
Passing Score: {passing_score}<br>
Course/Section: {course_code} | {course_title} - {section}<br><br>
'''
.
format
(
name
=
object
.
name
,
description
=
object
.
description
,
max_points
=
object
.
max_points
,
passing_score
=
object
.
passing_score
,
course_code
=
object
.
course
.
course_code
,
course_title
=
object
.
course
.
course_title
,
section
=
object
.
course
.
section
)
return
HttpResponse
(
display_output
)
def
detail
(
request
,
assignment_id
):
output
=
"These are the details for assignment #
%
s."
%
assignment_id
return
HttpResponse
(
output
)
\ 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