Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_bigdjangoenergy
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
Alec Dayupay
midterm_bigdjangoenergy
Commits
84d59cd8
Commit
84d59cd8
authored
Mar 02, 2023
by
Neo Emmanuel Ballesteros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created Assignments App
parent
ba2e2cf6
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
90 additions
and
4 deletions
+90
-4
__init__.cpython-311.pyc
...goenergy/assignments/__pycache__/__init__.cpython-311.pyc
+0
-0
admin.cpython-311.pyc
...jangoenergy/assignments/__pycache__/admin.cpython-311.pyc
+0
-0
apps.cpython-311.pyc
...djangoenergy/assignments/__pycache__/apps.cpython-311.pyc
+0
-0
models.cpython-311.pyc
...angoenergy/assignments/__pycache__/models.cpython-311.pyc
+0
-0
urls.cpython-311.pyc
...djangoenergy/assignments/__pycache__/urls.cpython-311.pyc
+0
-0
views.cpython-311.pyc
...jangoenergy/assignments/__pycache__/views.cpython-311.pyc
+0
-0
admin.py
widget_bigdjangoenergy/assignments/admin.py
+14
-1
0001_initial.py
...et_bigdjangoenergy/assignments/migrations/0001_initial.py
+34
-0
0001_initial.cpython-311.pyc
...ments/migrations/__pycache__/0001_initial.cpython-311.pyc
+0
-0
__init__.cpython-311.pyc
...signments/migrations/__pycache__/__init__.cpython-311.pyc
+0
-0
models.py
widget_bigdjangoenergy/assignments/models.py
+18
-1
urls.py
widget_bigdjangoenergy/assignments/urls.py
+9
-0
views.py
widget_bigdjangoenergy/assignments/views.py
+15
-2
No files found.
widget_bigdjangoenergy/assignments/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/__pycache__/admin.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/__pycache__/apps.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/__pycache__/models.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/__pycache__/urls.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/__pycache__/views.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/admin.py
View file @
84d59cd8
from
django.contrib
import
admin
# Register your models here.
from
.models
import
Assignment
,
Course
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
list_display
=
(
'name'
,
'description'
,
'course'
,
'perfect_score'
,
'passing_score'
,)
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
list_display
=
(
'code'
,
'title'
,
'section'
,)
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
widget_bigdjangoenergy/assignments/migrations/0001_initial.py
0 → 100644
View file @
84d59cd8
# Generated by Django 4.1.7 on 2023-03-02 07:00
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
initial
=
True
dependencies
=
[
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Assignment'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'name'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'description'
,
models
.
TextField
(
blank
=
True
,
null
=
True
)),
(
'course'
,
models
.
CharField
(
blank
=
True
,
max_length
=
50
,
null
=
True
)),
(
'perfect_score'
,
models
.
IntegerField
(
blank
=
True
,
null
=
True
)),
(
'passing_score'
,
models
.
IntegerField
(
blank
=
True
,
null
=
True
)),
],
),
migrations
.
CreateModel
(
name
=
'Course'
,
fields
=
[
(
'id'
,
models
.
BigAutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'code'
,
models
.
CharField
(
blank
=
True
,
max_length
=
10
,
null
=
True
)),
(
'title'
,
models
.
CharField
(
blank
=
True
,
max_length
=
100
,
null
=
True
)),
(
'section'
,
models
.
CharField
(
blank
=
True
,
max_length
=
3
,
null
=
True
)),
],
),
]
widget_bigdjangoenergy/assignments/migrations/__pycache__/0001_initial.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/migrations/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
84d59cd8
File added
widget_bigdjangoenergy/assignments/models.py
View file @
84d59cd8
from
django.db
import
models
# Create your models here.
class
Assignment
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
description
=
models
.
TextField
(
blank
=
True
,
null
=
True
)
course
=
models
.
CharField
(
max_length
=
50
,
blank
=
True
,
null
=
True
)
perfect_score
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
passing_score
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
self
.
name
class
Course
(
models
.
Model
):
code
=
models
.
CharField
(
max_length
=
10
,
blank
=
True
,
null
=
True
)
title
=
models
.
CharField
(
max_length
=
100
,
blank
=
True
,
null
=
True
)
section
=
models
.
CharField
(
max_length
=
3
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
return
self
.
code
\ No newline at end of file
widget_bigdjangoenergy/assignments/urls.py
0 → 100644
View file @
84d59cd8
from
django.urls
import
path
from
.views
import
index
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
]
app_name
=
"assignments"
\ No newline at end of file
widget_bigdjangoenergy/assignments/views.py
View file @
84d59cd8
from
django.
shortcuts
import
render
from
django.
http
import
HttpResponse
# Create your views here.
from
.models
import
Assignment
,
Course
def
index
(
request
):
assignmentlist
=
Assignment
.
objects
.
all
()
courselist
=
Course
.
objects
.
all
()
response
=
"Widget's Assignment Page"
i
=
0
while
i
<
len
(
assignmentlist
):
response
+=
f
"<br><br>Assignment Name: {assignmentlist[i].name}"
+
f
"<br>Description: {assignmentlist[i].description}"
+
f
"<br>Perfect Score: {assignmentlist[i].perfect_score}"
+
f
"<br>Passing Score: {assignmentlist[i].passing_score}<br>"
+
f
"Course/Section: {courselist[i].code} {courselist[i].title}-{courselist[i].section}"
i
+=
1
return
HttpResponse
(
response
)
\ No newline at end of file
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