Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_nicsbabes
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
Nics De Vega
midterm_nicsbabes
Commits
67339cd3
Commit
67339cd3
authored
Mar 06, 2023
by
rachbit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented modelels of app assignments
parent
f976335a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
admin.py
widget_nicsbabes/assignments/admin.py
+13
-1
models.py
widget_nicsbabes/assignments/models.py
+21
-1
No files found.
widget_nicsbabes/assignments/admin.py
View file @
67339cd3
from
django.contrib
import
admin
from
.models
import
Assignment
,
Course
# Register your models here.
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
list_display
=
(
'name'
,
'description'
,
'course'
,
'perfect_score'
,
'passing_score'
)
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
list_display
=
(
'code'
,
'title'
,
'section'
)
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
widget_nicsbabes/assignments/models.py
View file @
67339cd3
from
django.db
import
models
# Create your models here.
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
255
)
description
=
models
.
TextField
()
course
=
models
.
TextField
()
perfect_score
=
models
.
IntegerField
()
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
name
)
def
passing_score
(
self
):
return
(
self
.
perfect_score
*
60
)
//
100
class
Course
(
models
.
Model
):
code
=
models
.
CharField
(
max_length
=
10
)
title
=
models
.
CharField
(
max_length
=
255
)
section
=
models
.
CharField
(
max_length
=
3
)
def
__str__
(
self
):
return
'{}'
.
format
(
self
.
code
)
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