Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
final_quintupoltrobol
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
Matthew Karl David P. Arpas
final_quintupoltrobol
Commits
3826707d
Commit
3826707d
authored
Mar 04, 2023
by
Albert Gagalac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added model-Course and corresponding admin panel
parent
65da053d
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
7 deletions
+93
-7
admin.cpython-310.pyc
...tupoltrobol/assignments/__pycache__/admin.cpython-310.pyc
+0
-0
models.cpython-310.pyc
...upoltrobol/assignments/__pycache__/models.cpython-310.pyc
+0
-0
admin.py
widget_quintupoltrobol/assignments/admin.py
+6
-2
0002_assignment_course_delete_assignments_and_more.py
...ons/0002_assignment_course_delete_assignments_and_more.py
+71
-0
0002_assignment_course_delete_assignments_and_more.cpython-310.pyc
...gnment_course_delete_assignments_and_more.cpython-310.pyc
+0
-0
models.py
widget_quintupoltrobol/assignments/models.py
+16
-5
db.sqlite3
widget_quintupoltrobol/db.sqlite3
+0
-0
No files found.
widget_quintupoltrobol/assignments/__pycache__/admin.cpython-310.pyc
View file @
3826707d
No preview for this file type
widget_quintupoltrobol/assignments/__pycache__/models.cpython-310.pyc
View file @
3826707d
No preview for this file type
widget_quintupoltrobol/assignments/admin.py
View file @
3826707d
...
...
@@ -2,9 +2,13 @@ from django.contrib import admin
# Register your models here.
from
.models
import
Assignment
from
.models
import
Assignment
,
Course
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
\ No newline at end of file
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
\ No newline at end of file
widget_quintupoltrobol/assignments/migrations/0002_assignment_course_delete_assignments_and_more.py
0 → 100644
View file @
3826707d
# Generated by Django 4.1.7 on 2023-03-04 14:49
import
django.core.validators
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
"assignments"
,
"0001_initial"
),
]
operations
=
[
migrations
.
CreateModel
(
name
=
"Assignment"
,
fields
=
[
(
"id"
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
"ID"
,
),
),
(
"name"
,
models
.
CharField
(
default
=
""
,
max_length
=
50
)),
(
"description"
,
models
.
TextField
(
default
=
""
,
max_length
=
700
)),
(
"perfect_score"
,
models
.
PositiveIntegerField
(
default
=
0
)),
],
),
migrations
.
CreateModel
(
name
=
"Course"
,
fields
=
[
(
"id"
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
"ID"
,
),
),
(
"code"
,
models
.
CharField
(
default
=
""
,
max_length
=
10
)),
(
"title"
,
models
.
CharField
(
default
=
""
,
max_length
=
50
)),
(
"section"
,
models
.
CharField
(
default
=
""
,
max_length
=
3
,
unique
=
True
,
validators
=
[
django
.
core
.
validators
.
RegexValidator
(
"r^[a-zA-Z]*$"
,
"Only letters are allowed"
)
],
),
),
],
),
migrations
.
DeleteModel
(
name
=
"Assignments"
,
),
migrations
.
AddField
(
model_name
=
"assignment"
,
name
=
"course"
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
"assignments.course"
),
),
]
widget_quintupoltrobol/assignments/migrations/__pycache__/0002_assignment_course_delete_assignments_and_more.cpython-310.pyc
0 → 100644
View file @
3826707d
File added
widget_quintupoltrobol/assignments/models.py
View file @
3826707d
from
django.db
import
models
from
django.core.validators
import
RegexValidator
# Create your models here.
class
Course
(
models
.
Model
):
code
=
models
.
CharField
(
default
=
""
,
max_length
=
10
)
title
=
models
.
CharField
(
default
=
""
,
max_length
=
50
)
section
=
models
.
CharField
(
default
=
""
,
max_length
=
3
,
unique
=
True
,
validators
=
[
RegexValidator
(
r'^[a-zA-Z]*$'
,
message
=
'Only letters are allowed'
)])
def
__str__
(
self
):
return
"
%
s
%
s"
%
(
self
.
code
,
self
.
section
)
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
default
=
""
,
max_length
=
50
)
description
=
models
.
TextField
(
default
=
""
,
max_length
=
700
)
course
=
models
.
CharField
(
default
=
""
,
max_length
=
50
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
perfect_score
=
models
.
PositiveIntegerField
(
default
=
0
)
def
__str__
(
self
):
...
...
@@ -14,7 +28,4 @@ class Assignment(models.Model):
@
property
def
pass_score
(
self
):
passing_score
=
self
.
perfect_score
*
(
60
/
100
)
return
passing_score
return
passing_score
\ No newline at end of file
widget_quintupoltrobol/db.sqlite3
View file @
3826707d
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