Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widgets_FEKK
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
Kyla Martin
widgets_FEKK
Commits
374342e1
Commit
374342e1
authored
Mar 30, 2022
by
Katrina Bernice Tan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added new fields and models to Assignments, updated the View to reflect Assignment model
parent
95715cd4
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
153 additions
and
4 deletions
+153
-4
admin.py
WidgetFEKK/Assignments/admin.py
+14
-2
0002_assignment_passing_score.py
...K/Assignments/migrations/0002_assignment_passing_score.py
+19
-0
0003_course_remove_assignment_passing_score_and_more.py
...s/0003_course_remove_assignment_passing_score_and_more.py
+33
-0
0004_rename_section_assignment_course.py
...ments/migrations/0004_rename_section_assignment_course.py
+18
-0
0005_rename_course_assignment_course.py
...nments/migrations/0005_rename_course_assignment_course.py
+18
-0
0006_alter_assignment_course.py
...KK/Assignments/migrations/0006_alter_assignment_course.py
+19
-0
models.py
WidgetFEKK/Assignments/models.py
+22
-1
views.py
WidgetFEKK/Assignments/views.py
+10
-1
No files found.
WidgetFEKK/Assignments/admin.py
View file @
374342e1
from
django.contrib
import
admin
# Register your models here.
from
.models
import
Assignment
from
.models
import
Assignment
,
Course
admin
.
site
.
register
(
Assignment
)
\ No newline at end of file
#class CourseInline(admin.TabularInline):
# model = Course
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
search_fields
=
(
'name'
,
'max_points'
,)
list_display
=
(
'name'
,
'max_points'
,
'description'
,
'passing_score'
)
list_filter
=
(
'name'
,
'max_points'
,)
# inlines = [CourseInline,]
#admin.site.register(Course)
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
WidgetFEKK/Assignments/migrations/0002_assignment_passing_score.py
0 → 100644
View file @
374342e1
# Generated by Django 4.0.3 on 2022-03-26 17:10
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Assignments'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'passing_score'
,
field
=
models
.
IntegerField
(
default
=
1
),
preserve_default
=
False
,
),
]
WidgetFEKK/Assignments/migrations/0003_course_remove_assignment_passing_score_and_more.py
0 → 100644
View file @
374342e1
# Generated by Django 4.0.3 on 2022-03-26 17:42
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Assignments'
,
'0002_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
=
20
)),
(
'section'
,
models
.
CharField
(
max_length
=
3
)),
],
),
migrations
.
RemoveField
(
model_name
=
'assignment'
,
name
=
'passing_score'
,
),
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'section'
,
field
=
models
.
ForeignKey
(
default
=
69
,
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
related_name
=
'requirements'
,
to
=
'Assignments.course'
),
preserve_default
=
False
,
),
]
WidgetFEKK/Assignments/migrations/0004_rename_section_assignment_course.py
0 → 100644
View file @
374342e1
# Generated by Django 4.0.3 on 2022-03-26 17:44
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Assignments'
,
'0003_course_remove_assignment_passing_score_and_more'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'assignment'
,
old_name
=
'section'
,
new_name
=
'Course'
,
),
]
WidgetFEKK/Assignments/migrations/0005_rename_course_assignment_course.py
0 → 100644
View file @
374342e1
# Generated by Django 4.0.3 on 2022-03-26 17:44
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Assignments'
,
'0004_rename_section_assignment_course'
),
]
operations
=
[
migrations
.
RenameField
(
model_name
=
'assignment'
,
old_name
=
'Course'
,
new_name
=
'course'
,
),
]
WidgetFEKK/Assignments/migrations/0006_alter_assignment_course.py
0 → 100644
View file @
374342e1
# Generated by Django 4.0.3 on 2022-03-26 17:51
from
django.db
import
migrations
,
models
import
django.db.models.deletion
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'Assignments'
,
'0005_rename_course_assignment_course'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'assignment'
,
name
=
'course'
,
field
=
models
.
ForeignKey
(
on_delete
=
django
.
db
.
models
.
deletion
.
CASCADE
,
to
=
'Assignments.course'
),
),
]
WidgetFEKK/Assignments/models.py
View file @
374342e1
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
=
20
)
section
=
models
.
CharField
(
max_length
=
3
)
def
__str__
(
self
):
return
'{} {} {} '
.
format
(
self
.
course_code
,
self
.
course_title
,
self
.
section
)
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
69
)
description
=
models
.
CharField
(
max_length
=
420
)
max_points
=
models
.
IntegerField
()
\ No newline at end of file
max_points
=
models
.
IntegerField
()
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
,
related_name
=
'requirements'
)
def
__str__
(
self
):
return
'Assignment name: {} :{}'
.
format
(
self
.
name
,
self
.
description
)
@
property
def
passing_score
(
self
):
#return self.passing_score == 69
return
self
.
max_points
*
.6
WidgetFEKK/Assignments/views.py
View file @
374342e1
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
.models
import
Assignment
,
Course
def
index
(
request
):
return
HttpResponse
(
'This is the Assignments page!'
)
print
=
"ANNOUNCEMENTS: "
assignments
=
Assignment
.
objects
.
all
()
for
i
in
assignments
:
#print += "Assignment Name: " + i.name + "\n Description + " + i.description + "\n Perfect Score + " + str(i.max_points) + "\n Passing Score: " + str(i.passing_score) + "\n Course/Section: "
print
+=
f
"<br /> Assignment name: {i.name} <br /> Description: {i.description} <br /> Perfect score: {i.max_points} <br /> Passing score: {i.passing_score} <br /> Course/Section: {i.course} <br />"
return
HttpResponse
(
print
)
# Create your views here.
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