Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_vincentdjango
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
1
Merge Requests
1
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
Almira Redoble
midterm_vincentdjango
Commits
e073ed3d
Commit
e073ed3d
authored
Mar 05, 2023
by
Star Neptune R. Sy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first version of admin panel done
parent
e3adc642
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
7 deletions
+29
-7
admin.py
widget_vincentdjango/assignments/admin.py
+24
-1
models.py
widget_vincentdjango/assignments/models.py
+1
-1
views.py
widget_vincentdjango/assignments/views.py
+4
-5
db.sqlite3
widget_vincentdjango/db.sqlite3
+0
-0
No files found.
widget_vincentdjango/assignments/admin.py
View file @
e073ed3d
from
django.contrib
import
admin
from
.models
import
Assignment
,
Course
# Register your models here.
class
AssignmentInline
(
admin
.
StackedInline
):
model
=
Assignment
class
AssignmentAdmin
(
admin
.
ModelAdmin
):
model
=
Assignment
list_display
=
(
'assignment_name'
,
'section'
)
search_fields
=
(
'course'
,)
list_filter
=
(
'section'
,
'perfect_score'
,
'passing_score'
)
class
CourseAdmin
(
admin
.
ModelAdmin
):
model
=
Course
list_display
=
(
'course_code'
,
'course_title'
,)
search_fields
=
(
'course_code'
,
'course_title'
,)
list_filter
=
(
'course_code'
,
'course_title'
,)
admin
.
site
.
register
(
Course
,
CourseAdmin
)
admin
.
site
.
register
(
Assignment
,
AssignmentAdmin
)
\ No newline at end of file
widget_vincentdjango/assignments/models.py
View file @
e073ed3d
...
...
@@ -2,7 +2,7 @@ from django.db import models
class
Course
(
models
.
Model
):
course_code
=
models
.
CharField
(
unique
=
True
,
default
=
""
,
max_length
=
5
0
,)
course_code
=
models
.
CharField
(
unique
=
True
,
default
=
""
,
max_length
=
1
0
,)
course_title
=
models
.
CharField
(
unique
=
True
,
default
=
""
,
max_length
=
50
,)
def
__str__
(
self
):
...
...
widget_vincentdjango/assignments/views.py
View file @
e073ed3d
...
...
@@ -9,10 +9,10 @@ def index(request):
head
=
"<h1 style='border-bottom:4px solid lightgray;
\
padding-bottom:30px;
\
font-size:500
%
;'>
\
W
elcome to Widget!
\
</h1>"
W
idget's assignment page
\
</h1>
\n
"
body
=
"
<h2>WIDGET USERS:</h2>
"
body
=
""
for
subject
in
Assignment
.
objects
.
all
():
body
+=
"<p style='border: 2px solid gray;
\
...
...
@@ -26,8 +26,7 @@ def index(request):
</p>"
return_string
=
"<html>
\
<body style = 'font-family:helvetica;
\
padding:30px;'>
\
<body>
\
{}{}
\
</body></html>"
.
format
(
head
,
body
)
...
...
widget_vincentdjango/db.sqlite3
View file @
e073ed3d
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