Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_robo_mommy
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Raul Jarod Conanan
midterm_robo_mommy
Commits
9e2bfae4
Commit
9e2bfae4
authored
May 12, 2023
by
Lance Dominic B. Santuyo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added functions to return necessary URLs
parent
512987e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
models.py
widget_robo_mommy/Assignments/models.py
+13
-0
No files found.
widget_robo_mommy/Assignments/models.py
View file @
9e2bfae4
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
class
Course
(
models
.
Model
):
class
Course
(
models
.
Model
):
...
@@ -6,6 +7,9 @@ class Course(models.Model):
...
@@ -6,6 +7,9 @@ class Course(models.Model):
title
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
title
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
section
=
models
.
CharField
(
max_length
=
3
,
blank
=
True
,
null
=
True
)
section
=
models
.
CharField
(
max_length
=
3
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
self
.
code
+
'-'
+
self
.
section
class
Assignment
(
models
.
Model
):
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
name
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
,
null
=
True
)
...
@@ -17,3 +21,12 @@ class Assignment(models.Model):
...
@@ -17,3 +21,12 @@ class Assignment(models.Model):
def
save
(
self
,
*
args
,
**
kwargs
):
def
save
(
self
,
*
args
,
**
kwargs
):
self
.
passing_score
=
int
(
self
.
perfect_score
*
0.60
)
self
.
passing_score
=
int
(
self
.
perfect_score
*
0.60
)
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
super
(
Assignment
,
self
)
.
save
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
return
self
.
name
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignments-item'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_update_url
(
self
):
return
reverse
(
'assignments:assignments-edit'
,
kwargs
=
{
'pk'
:
self
.
pk
})
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