Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_k3git
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
Stefan Gomez
midterm_k3git
Commits
69a7457a
Commit
69a7457a
authored
Mar 06, 2023
by
Nate Brevin A. Que
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'assignments' into 'master'
Assignments See merge request
!4
parents
76fad82b
93bbac92
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
13 deletions
+30
-13
0002_remove_assignment_passing_score.py
...nments/migrations/0002_remove_assignment_passing_score.py
+17
-0
models.py
widget_k3git/assignments/models.py
+10
-2
views.py
widget_k3git/assignments/views.py
+3
-11
No files found.
widget_k3git/assignments/migrations/0002_remove_assignment_passing_score.py
0 → 100644
View file @
69a7457a
# Generated by Django 3.2 on 2023-03-06 11:36
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'assignment'
,
name
=
'passing_score'
,
),
]
widget_k3git/assignments/models.py
View file @
69a7457a
...
@@ -15,7 +15,15 @@ class Assignment(models.Model):
...
@@ -15,7 +15,15 @@ class Assignment(models.Model):
description
=
models
.
TextField
()
description
=
models
.
TextField
()
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
perfect_score
=
models
.
IntegerField
()
perfect_score
=
models
.
IntegerField
()
passing_score
=
models
.
IntegerField
()
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
"""Assignment Name: {}<br>
\ No newline at end of file
Description: {}<br>
Perfect Score: {}<br>
Passing Score: {}<br>
Course/Section: {}<br>"""
.
format
(
self
.
name
,
self
.
description
,
self
.
perfect_score
,
self
.
passing_score
,
self
.
course
)
@
property
def
passing_score
(
self
):
return
round
(
self
.
perfect_score
*
6
/
10
)
\ No newline at end of file
widget_k3git/assignments/views.py
View file @
69a7457a
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Course
,
Assignment
from
.models
import
Assignment
def
index
(
request
):
def
index
(
request
):
page_content
=
"""<H1>Widget's Assignments Page</H1>""
"
page_content
=
"<H1>Widget's Assignments Page</H1><ul>
"
for
assignment
in
Assignment
.
objects
.
all
():
for
assignment
in
Assignment
.
objects
.
all
():
page_content
+=
"""<ul>
page_content
+=
"<li>{}<br>"
.
format
(
assignment
)
<li>Assignment Name: {}<br>
<li>Description: {}<br>
<li>Perfect Score: {}<br>
<li>Passing Score: {}<br>
<li>Course/Section: {}<br>
</ul>"""
.
format
(
assignment
.
name
,
assignment
.
description
,
assignment
.
perfect_score
,
assignment
.
passing_score
,
assignment
.
course
)
return
HttpResponse
(
page_content
)
return
HttpResponse
(
page_content
)
\ 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