Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group17
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
Vaughn Nephi Fajardo
widget_group17
Commits
1cc16eb5
Commit
1cc16eb5
authored
May 18, 2022
by
Joan Denise Nocos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: added index and details templates to assignments app
parent
75ba0626
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
18 deletions
+56
-18
urls.cpython-39.pyc
widget_group_17/assignments/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
widget_group_17/assignments/__pycache__/views.cpython-39.pyc
+0
-0
details.html
...t_group_17/assignments/templates/assignments/details.html
+12
-0
index.html
widget_group_17/assignments/templates/assignments/index.html
+25
-0
urls.py
widget_group_17/assignments/urls.py
+1
-0
views.py
widget_group_17/assignments/views.py
+18
-18
No files found.
widget_group_17/assignments/__pycache__/urls.cpython-39.pyc
View file @
1cc16eb5
No preview for this file type
widget_group_17/assignments/__pycache__/views.cpython-39.pyc
View file @
1cc16eb5
No preview for this file type
widget_group_17/assignments/templates/assignments/details.html
0 → 100644
View file @
1cc16eb5
{% extends "base.html" %}
{% block page-title %}Assignment {{ assignment_id }} Details{% endblock %}
{% block content %}
<h1>
{{ course.course_code }} {{ course.course_title }} {{ course.section }}
</h1>
<p>
{{ assignment.name }}
</p>
<p>
{{ assignment.description }}
</p>
<p>
{{ assignment.max_points }}
</p>
<p>
{{ assignment.passing_score }}
</p>
<p>
Image Placeholder
</p>
{% endblock %}
\ No newline at end of file
widget_group_17/assignments/templates/assignments/index.html
0 → 100644
View file @
1cc16eb5
{% extends "base.html" %}
{% block page-title %}Assignments{% endblock %}
{% block content %}
<h1>
Assignments Per Course
</h1>
<h2>
List of Courses:
</h2>
{% if course_list %}
<ul>
{% for course in course_list %}
<p>
{{ course.course_code }} {{ course.course_title }} {{ course.section }}
</p>
<ul>
{% for assignment in assignment_list %}
{% if assignment.course == course.id %}
<li><a
href=
"{% url 'assignments:details' assignment.id %}"
>
{{ assignment.name }}
</a></li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
</ul>
{% else %}
<p>
No course available.
</p>
{% endif %}
{% endblock %}
widget_group_17/assignments/urls.py
View file @
1cc16eb5
...
...
@@ -2,6 +2,7 @@ from django.urls import path
from
.
import
views
app_name
=
"assignments"
urlpatterns
=
[
# assignments/
path
(
''
,
views
.
index
,
name
=
'index'
),
...
...
widget_group_17/assignments/views.py
View file @
1cc16eb5
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
assignments.models
import
Assignment
,
Course
# Create your views here.
def
index
(
request
):
assignments_view
=
"ASSIGNMENTS: <br>"
schoolwork
=
Assignment
.
objects
.
all
()
for
assignment
in
schoolwork
:
score
=
assignment
.
max_points
assignment
.
passing_score
=
(
score
*
60
)
//
100
assignments_view
+=
"Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {} {}<br><br>"
.
\
format
(
assignment
.
name
,
assignment
.
description
,
assignment
.
max_points
,
assignment
.
passing_score
,
assignment
.
course
.
course_code
,
assignment
.
course
.
course_title
,
assignment
.
course
.
section
)
return
HttpResponse
(
assignments_view
)
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
assignment_list
=
Assignment
.
objects
.
all
()
context
=
{
"course_list"
:
course_list
,
"assignment_list"
:
assignment_list
,
}
return
render
(
request
,
"assignments/index.html"
,
context
)
def
details
(
request
,
assignment_id
):
response
=
"Assignment ID:
%
s."
return
HttpResponse
(
response
%
assignment_id
)
\ No newline at end of file
try
:
assignment
=
Article
.
objects
.
get
(
pk
=
assignment_id
)
except
Assignment
.
DoesNotExist
:
raise
Http404
(
"Assignment does not exist!"
)
context
=
{
"assignment"
:
assignment
,
"course"
:
assignment
.
course
,
}
return
render
(
request
,
"assignments/details.html"
,
context
)
\ 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