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
88a97886
Commit
88a97886
authored
Apr 02, 2022
by
Earl Edison B. Felizardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited views.py to display Assignment entries with corresponding Course
parent
c948f654
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
views.py
widget_group_25/assignments/views.py
+19
-2
No files found.
widget_group_25/assignments/views.py
View file @
88a97886
from
django.shortcuts
import
HttpResponse
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Assignment
,
Course
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
return
HttpResponse
(
"This is the Assignments page!"
)
heading
=
'ASSIGNMENTS:<br><br>'
assignments
=
Assignment
.
objects
.
all
()
body
=
''
for
assignment
in
assignments
:
courses
=
Course
.
objects
.
filter
(
course_code__exact
=
assignment
.
course_code
)
body
+=
'Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>'
.
format
(
assignment
.
name
,
assignment
.
description
,
assignment
.
max_points
,
assignment
.
passing_score
)
for
course
in
courses
:
body
+=
'Course/Section: {} {} {}<br><br>'
.
format
(
course
.
course_code
,
course
.
course_title
,
course
.
section
)
return
HttpResponse
(
heading
+
body
)
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