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
8386bb6d
Commit
8386bb6d
authored
May 17, 2022
by
Earl Edison B. Felizardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added details view
parent
e50b2b2a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
13 deletions
+30
-13
views.py
widget_group_25/assignments/views.py
+30
-13
No files found.
widget_group_25/assignments/views.py
View file @
8386bb6d
...
...
@@ -5,18 +5,35 @@ from .models import Assignment, Course
# Create your views here.
def
index
(
request
):
heading
=
'ASSIGNMENTS:<br><br>'
assignments
=
Assignment
.
objects
.
all
()
body
=
''
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
assignments_list
=
Assignment
.
objects
.
order_by
(
"name"
)
context
=
{
"course_list"
:
course_list
,
"assignments_list"
:
assignments_list
,
}
return
render
(
request
,
"assignments/assignments_list.html"
,
context
)
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
)
# 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)
return
HttpResponse
(
heading
+
body
)
def
detail
(
request
,
pk
):
assignment
=
Assignment
.
objects
.
get
(
pk
=
pk
)
course
=
Course
.
objects
.
get
(
course_code__exact
=
assignment
.
course_code
)
context
=
{
"assignment"
:
assignment
,
"course"
:
course
,
}
return
render
(
request
,
"assignments/assignments_detail.html"
,
context
)
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