Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_huli
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
Izaac Daniel B. Muncal
midterm_huli
Commits
353dc104
Commit
353dc104
authored
Mar 05, 2023
by
Brescia Amandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created models for the Assignments app
parent
0fe4e519
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
1 deletion
+58
-1
models.cpython-310.pyc
widget_huli/assignments/__pycache__/models.cpython-310.pyc
+0
-0
0001_initial.py
widget_huli/assignments/migrations/0001_initial.py
+34
-0
0001_initial.cpython-310.pyc
...ments/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
models.py
widget_huli/assignments/models.py
+24
-1
No files found.
widget_huli/assignments/__pycache__/models.cpython-310.pyc
View file @
353dc104
No preview for this file type
widget_huli/assignments/migrations/0001_initial.py
0 → 100644
View file @
353dc104
# Generated by Django 3.0 on 2023-03-05 12:46
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Course'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'code'
,
models
.
CharField
(
max_length
=
10
)),
(
'title'
,
models
.
CharField
(
max_length
=
255
)),
(
'section'
,
models
.
CharField
(
blank
=
True
,
max_length
=
3
)),
],
),
migrations
.
CreateModel
(
name
=
'Assignment'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
max_length
=
255
)),
(
'description'
,
models
.
TextField
(
blank
=
True
)),
(
'perfect_score'
,
models
.
IntegerField
(
blank
=
True
,
default
=
0
)),
(
'course'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assignments.Course'
)),
],
),
]
widget_huli/assignments/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
353dc104
File added
widget_huli/assignments/models.py
View file @
353dc104
from
django.db
import
models
from
django.db
import
models
# Create your models here.
class
Course
(
models
.
Model
):
code
=
models
.
CharField
(
max_length
=
10
)
title
=
models
.
CharField
(
max_length
=
255
)
section
=
models
.
CharField
(
max_length
=
3
,
blank
=
True
)
def
__str__
(
self
):
return
self
.
code
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
)
description
=
models
.
TextField
(
blank
=
True
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
perfect_score
=
models
.
IntegerField
(
blank
=
True
,
default
=
0
)
@
property
def
passing_score
(
self
):
passing_score
=
self
.
perfect_score
*
0.60
return
passing_score
def
__str__
(
self
):
return
self
.
name
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