Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_someone here is possessed by an owl
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
Laetitia de Castro
widget_someone here is possessed by an owl
Commits
9262b0ec
Commit
9262b0ec
authored
Apr 05, 2022
by
kylemendozaa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated assignments view
parent
5224c323
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
2 deletions
+38
-2
models.cpython-39.pyc
assignments/__pycache__/models.cpython-39.pyc
+0
-0
views.cpython-39.pyc
assignments/__pycache__/views.cpython-39.pyc
+0
-0
0003_rename_course_section_course_section.py
...s/migrations/0003_rename_course_section_course_section.py
+18
-0
0003_rename_course_section_course_section.cpython-39.pyc
.../0003_rename_course_section_course_section.cpython-39.pyc
+0
-0
models.py
assignments/models.py
+12
-1
views.py
assignments/views.py
+8
-1
db.sqlite3
db.sqlite3
+0
-0
No files found.
assignments/__pycache__/models.cpython-39.pyc
View file @
9262b0ec
No preview for this file type
assignments/__pycache__/views.cpython-39.pyc
View file @
9262b0ec
No preview for this file type
assignments/migrations/0003_rename_course_section_course_section.py
0 → 100644
View file @
9262b0ec
# Generated by Django 4.0.3 on 2022-04-05 15:09
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0002_course_assignment_passing_score_and_more'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'course'
,
old_name
=
'course_section'
,
new_name
=
'section'
,
),
]
assignments/migrations/__pycache__/0003_rename_course_section_course_section.cpython-39.pyc
0 → 100644
View file @
9262b0ec
File added
assignments/models.py
View file @
9262b0ec
...
@@ -3,7 +3,7 @@ from django.db import models
...
@@ -3,7 +3,7 @@ from django.db import models
class
Course
(
models
.
Model
):
class
Course
(
models
.
Model
):
course_code
=
models
.
CharField
(
max_length
=
10
)
course_code
=
models
.
CharField
(
max_length
=
10
)
course_title
=
models
.
CharField
(
max_length
=
50
)
course_title
=
models
.
CharField
(
max_length
=
50
)
course_
section
=
models
.
CharField
(
max_length
=
3
)
section
=
models
.
CharField
(
max_length
=
3
)
class
Assignment
(
models
.
Model
):
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
30
)
name
=
models
.
CharField
(
max_length
=
30
)
...
@@ -15,3 +15,14 @@ class Assignment(models.Model):
...
@@ -15,3 +15,14 @@ class Assignment(models.Model):
def
save
(
self
):
def
save
(
self
):
self
.
passing_score
=
int
(
0.6
*
self
.
max_points
)
self
.
passing_score
=
int
(
0.6
*
self
.
max_points
)
super
(
Assignment
,
self
)
.
save
()
super
(
Assignment
,
self
)
.
save
()
def
getAssignment
(
self
):
return
'Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {} {}<br>'
.
format
(
self
.
name
,
self
.
description
,
self
.
max_points
,
self
.
passing_score
,
self
.
course
.
course_code
,
self
.
course
.
course_title
,
self
.
course
.
section
,
)
assignments/views.py
View file @
9262b0ec
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Assignment
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
return
HttpResponse
(
"This is the Assignments page!"
)
formatted_assignments
=
"ASSIGNMENTS:<br>"
for
assignment
in
Assignment
.
objects
.
all
():
formatted_assignments
+=
assignment
.
getAssignment
()
+
"<br>"
return
HttpResponse
(
formatted_assignments
)
db.sqlite3
View file @
9262b0ec
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