Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
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
Angelico Ruiz T. Teaño
widget_Alipins
Commits
8dc6d87b
Commit
8dc6d87b
authored
Apr 02, 2022
by
Angelico Ruiz T. Teaño
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Course model in assignments app
parent
9bdd23fa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
3 deletions
+47
-3
admin.py
widget_alipins/assignments/admin.py
+9
-3
0004_course_assignment_course.py
...s/assignments/migrations/0004_course_assignment_course.py
+28
-0
models.py
widget_alipins/assignments/models.py
+10
-0
db.sqlite3
widget_alipins/db.sqlite3
+0
-0
No files found.
widget_alipins/assignments/admin.py
View file @
8dc6d87b
from
django.contrib
import
admin
# Register your models here.
from
.models
import
Assignment
from
.models
import
Assignment
,
Course
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
search_fields
=
[
'course_code'
,
'course_title'
,
'section'
]
list_display
=
(
'course_code'
,
'course_title'
,
'section'
)
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
search_fields
=
[
'name'
,
'description'
]
list_display
=
(
'name'
,
'description'
,
'passing_score'
,
'max_points'
)
search_fields
=
[
'name'
,
'description'
,
'course'
]
list_display
=
(
'name'
,
'description'
,
'passing_score'
,
'max_points'
,
'course'
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
\ No newline at end of file
widget_alipins/assignments/migrations/0004_course_assignment_course.py
0 → 100644
View file @
8dc6d87b
# Generated by Django 4.0.3 on 2022-04-02 10:51
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0003_assignment_passing_score'
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Course'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'course_code'
,
models
.
CharField
(
max_length
=
10
)),
(
'course_title'
,
models
.
CharField
(
max_length
=
50
)),
(
'section'
,
models
.
CharField
(
max_length
=
3
)),
],
),
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'course'
,
field
=
models
.
ForeignKey
(
default
=
1
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assignments.course'
),
),
]
widget_alipins/assignments/models.py
View file @
8dc6d87b
from
django.db
import
models
# 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
):
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
TextField
(
max_length
=
1500
)
max_points
=
models
.
IntegerField
(
default
=
0
)
passing_score
=
models
.
IntegerField
(
default
=
0
,
editable
=
False
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
,
default
=
1
)
def
__str__
(
self
):
return
self
.
name
...
...
widget_alipins/db.sqlite3
View file @
8dc6d87b
No preview for this file type
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