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
c948f654
Commit
c948f654
authored
Apr 02, 2022
by
Earl Edison B. Felizardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Course model and added passing_score field on Assignment model
parent
051a1c1b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletion
+15
-1
models.py
widget_group_25/assignments/models.py
+15
-1
No files found.
widget_group_25/assignments/models.py
View file @
c948f654
from
django.db
import
models
from
django.db
import
models
# Create your models here.
# Create your models here.
class
Course
(
models
.
Model
):
course_code
=
models
.
CharField
(
max_length
=
10
)
course_title
=
models
.
CharField
(
max_length
=
50
)
section
=
models
.
CharField
(
max_length
=
3
)
def
__str__
(
self
):
return
self
.
course_code
class
Assignment
(
models
.
Model
):
class
Assignment
(
models
.
Model
):
course_code
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
name
=
models
.
CharField
(
max_length
=
50
)
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
CharField
(
max_length
=
500
)
description
=
models
.
CharField
(
max_length
=
500
)
max_points
=
models
.
IntegerField
()
max_points
=
models
.
IntegerField
(
default
=
0
)
passing_score
=
models
.
IntegerField
(
default
=
0
,
editable
=
False
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
def
save
(
self
):
self
.
passing_score
=
int
(
self
.
max_points
*
0.6
)
return
super
(
Assignment
,
self
)
.
save
()
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