Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_princessgabi
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
Ysabella Panghulan
midterm_princessgabi
Commits
0eb6540c
Commit
0eb6540c
authored
Mar 06, 2023
by
Ysabella Panghulan
Browse files
Options
Browse Files
Download
Plain Diff
Merged widget_assignments branch to main
parents
80abf5e8
2c33d930
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
120 additions
and
1 deletion
+120
-1
__init__.py
widget_princessgabi/assignments/__init__.py
+0
-0
__init__.cpython-310.pyc
...cessgabi/assignments/__pycache__/__init__.cpython-310.pyc
+0
-0
admin.cpython-310.pyc
...rincessgabi/assignments/__pycache__/admin.cpython-310.pyc
+0
-0
apps.cpython-310.pyc
...princessgabi/assignments/__pycache__/apps.cpython-310.pyc
+0
-0
models.cpython-310.pyc
...incessgabi/assignments/__pycache__/models.cpython-310.pyc
+0
-0
admin.py
widget_princessgabi/assignments/admin.py
+26
-0
apps.py
widget_princessgabi/assignments/apps.py
+6
-0
0001_initial.py
widget_princessgabi/assignments/migrations/0001_initial.py
+34
-0
__init__.py
widget_princessgabi/assignments/migrations/__init__.py
+0
-0
0001_initial.cpython-310.pyc
...ments/migrations/__pycache__/0001_initial.cpython-310.pyc
+0
-0
__init__.cpython-310.pyc
...signments/migrations/__pycache__/__init__.cpython-310.pyc
+0
-0
models.py
widget_princessgabi/assignments/models.py
+23
-0
tests.py
widget_princessgabi/assignments/tests.py
+3
-0
urls.py
widget_princessgabi/assignments/urls.py
+6
-0
views.py
widget_princessgabi/assignments/views.py
+22
-0
settings.py
widget_princessgabi/widget_princessgabi/settings.py
+0
-1
No files found.
widget_princessgabi/assignments/__init__.py
0 → 100644
View file @
0eb6540c
widget_princessgabi/assignments/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
0eb6540c
File added
widget_princessgabi/assignments/__pycache__/admin.cpython-310.pyc
0 → 100644
View file @
0eb6540c
File added
widget_princessgabi/assignments/__pycache__/apps.cpython-310.pyc
0 → 100644
View file @
0eb6540c
File added
widget_princessgabi/assignments/__pycache__/models.cpython-310.pyc
0 → 100644
View file @
0eb6540c
File added
widget_princessgabi/assignments/admin.py
0 → 100644
View file @
0eb6540c
from
django.contrib
import
admin
from
.models
import
Assignment
,
Course
# Register your models here.
class
AssignmentInLine
(
admin
.
TabularInline
):
model
=
Assignment
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
list_display
=
(
'code'
,
'title'
,
'section'
)
search_fields
=
(
'code'
,
'title'
,
'section'
)
inlines
=
[
AssignmentInLine
]
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'name'
,
'description'
,
'course'
,
'perfect_score'
,
'passing_score'
)
def
get_name
(
self
,
obj
):
return
obj
.
assignment
.
name
get_name
.
short_description
=
'name'
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
widget_princessgabi/assignments/apps.py
0 → 100644
View file @
0eb6540c
from
django.apps
import
AppConfig
class
AssignmentsConfig
(
AppConfig
):
default_auto_field
=
'django.db.models.BigAutoField'
name
=
'assignments'
widget_princessgabi/assignments/migrations/0001_initial.py
0 → 100644
View file @
0eb6540c
# Generated by Django 4.1.7 on 2023-03-05 05: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
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'code'
,
models
.
CharField
(
max_length
=
10
)),
(
'title'
,
models
.
CharField
(
max_length
=
50
)),
(
'section'
,
models
.
CharField
(
max_length
=
3
)),
],
),
migrations
.
CreateModel
(
name
=
'Assignment'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
max_length
=
50
)),
(
'description'
,
models
.
TextField
(
max_length
=
500
)),
(
'perfect_score'
,
models
.
IntegerField
(
default
=
0
)),
(
'course'
,
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'assignments.course'
)),
],
),
]
widget_princessgabi/assignments/migrations/__init__.py
0 → 100644
View file @
0eb6540c
widget_princessgabi/assignments/migrations/__pycache__/0001_initial.cpython-310.pyc
0 → 100644
View file @
0eb6540c
File added
widget_princessgabi/assignments/migrations/__pycache__/__init__.cpython-310.pyc
0 → 100644
View file @
0eb6540c
File added
widget_princessgabi/assignments/models.py
0 → 100644
View file @
0eb6540c
from
django.db
import
models
# Create your models here.
class
Course
(
models
.
Model
):
code
=
models
.
CharField
(
max_length
=
10
)
title
=
models
.
CharField
(
max_length
=
50
)
section
=
models
.
CharField
(
max_length
=
3
)
def
__str__
(
self
):
return
self
.
code
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
TextField
(
max_length
=
500
)
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
perfect_score
=
models
.
IntegerField
(
default
=
0
)
@
property
def
passing_score
(
self
):
return
round
(
self
.
perfect_score
*
0.6
)
def
__str__
(
self
):
return
self
.
name
\ No newline at end of file
widget_princessgabi/assignments/tests.py
0 → 100644
View file @
0eb6540c
from
django.test
import
TestCase
# Create your tests here.
widget_princessgabi/assignments/urls.py
0 → 100644
View file @
0eb6540c
from
django.urls
import
path
from
.
import
views
urlpatterns
=
[
path
(
''
,
views
.
assignments
,
name
=
"assignments"
),
]
\ No newline at end of file
widget_princessgabi/assignments/views.py
0 → 100644
View file @
0eb6540c
from
django.http
import
HttpResponse
from
.models
import
Assignment
,
Course
# Create your views here.
def
assignments
(
request
):
homeworks
=
Assignment
.
objects
.
all
()
display
=
'Widget
\'
s Assignments Page<br><br>'
for
homework
in
homeworks
:
assignment_name
=
homework
.
name
assignment_description
=
homework
.
description
assignment_perfect_score
=
homework
.
perfect_score
assignment_passing_score
=
homework
.
passing_score
course_code
=
homework
.
course
.
code
course_title
=
homework
.
course
.
title
course_section
=
homework
.
course
.
section
display
+=
'Assignment Name: '
+
assignment_name
+
'<br>'
display
+=
'Description: '
+
assignment_description
+
'<br>'
display
+=
'Perfect Score: '
+
str
(
assignment_perfect_score
)
+
'<br>'
display
+=
'Passing Score: '
+
str
(
assignment_passing_score
)
+
'<br>'
display
+=
'Course/Section: '
+
course_code
+
' '
+
course_title
+
'-'
+
course_section
+
'<br><br>'
return
HttpResponse
(
display
)
\ No newline at end of file
widget_princessgabi/widget_princessgabi/settings.py
View file @
0eb6540c
...
...
@@ -35,7 +35,6 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS
=
[
'forum'
,
'dashboard'
,
'django.contrib.admin'
,
'django.contrib.auth'
,
...
...
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