Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_huli
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
Izaac Daniel B. Muncal
midterm_huli
Commits
af90e4c6
Commit
af90e4c6
authored
May 12, 2023
by
Brescia Amandy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created the new views and linked them to a URL
parent
7ee2e782
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
13 deletions
+35
-13
urls.cpython-310.pyc
widget_huli/assignments/__pycache__/urls.cpython-310.pyc
+0
-0
views.cpython-310.pyc
widget_huli/assignments/__pycache__/views.cpython-310.pyc
+0
-0
assignment-add.html
...uli/assignments/templates/assignments/assignment-add.html
+1
-0
assignment-details.html
...assignments/templates/assignments/assignment-details.html
+1
-0
assignment-edit.html
...li/assignments/templates/assignments/assignment-edit.html
+1
-0
assignments.html
...t_huli/assignments/templates/assignments/assignments.html
+1
-0
urls.py
widget_huli/assignments/urls.py
+4
-1
views.py
widget_huli/assignments/views.py
+26
-10
settings.py
widget_huli/widget_huli/settings.py
+1
-1
urls.py
widget_huli/widget_huli/urls.py
+0
-1
No files found.
widget_huli/assignments/__pycache__/urls.cpython-310.pyc
View file @
af90e4c6
No preview for this file type
widget_huli/assignments/__pycache__/views.cpython-310.pyc
View file @
af90e4c6
No preview for this file type
widget_huli/assignments/templates/assignments/assignment-add.html
0 → 100644
View file @
af90e4c6
assignment-add.html
\ No newline at end of file
widget_huli/assignments/templates/assignments/assignment-details.html
0 → 100644
View file @
af90e4c6
assignment-details.html
\ No newline at end of file
widget_huli/assignments/templates/assignments/assignment-edit.html
0 → 100644
View file @
af90e4c6
assignment-edit.html
\ No newline at end of file
widget_huli/assignments/templates/assignments/assignments.html
0 → 100644
View file @
af90e4c6
Assignments.html
\ No newline at end of file
widget_huli/assignments/urls.py
View file @
af90e4c6
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
assignments
from
.views
import
assignments
from
.views
import
AssignmentDetails
,
AssignmentAdd
,
AssignmentEdit
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
assignments
,
name
=
'assignments'
),
path
(
''
,
assignments
,
name
=
'assignments'
),
path
(
'<pk>/details'
,
AssignmentDetails
.
as_view
(),
name
=
'assignment-details'
),
path
(
'add'
,
AssignmentAdd
.
as_view
(),
name
=
'assignment-add'
),
path
(
'<pk>/edit'
,
AssignmentEdit
.
as_view
(),
name
=
'assignment-edit'
),
]
]
# This might be needed depending on your Django version
# This might be needed depending on your Django version
...
...
widget_huli/assignments/views.py
View file @
af90e4c6
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Assignment
,
Course
from
.models
import
Assignment
,
Course
def
assignments
(
request
):
def
assignments
(
request
):
return_string
=
"Widget's Assignments Page<br><br>"
return
render
(
request
,
'assignments/assignments.html'
)
for
assignment
,
course
in
zip
(
Assignment
.
objects
.
all
(),
Course
.
objects
.
all
()):
return_string
+=
'Assignment: {}<br>'
.
format
(
assignment
.
name
)
return_string
+=
'Description: {}<br>'
.
format
(
assignment
.
description
)
return_string
+=
'Perfect Score: {}<br>'
.
format
(
assignment
.
perfect_score
)
return_string
+=
'Passing Score: {}<br>'
.
format
(
assignment
.
passing_score
)
return_string
+=
'Course/Section: {} {}-{}<br><br>'
.
format
(
course
.
code
,
course
.
title
,
course
.
section
)
return
HttpResponse
(
return_string
)
class
AssignmentDetails
(
DetailView
):
model
=
Assignment
template_name
=
'assignments/assignment-details.html'
class
AssignmentAdd
(
CreateView
):
model
=
Assignment
template_name
=
'assignments/assignment-add.html'
fields
=
[
'name'
,
'description'
,
'course'
,
'perfect_score'
,
]
class
AssignmentEdit
(
UpdateView
):
model
=
Assignment
template_name
=
'assignments/assignment-edit.html'
fields
=
[
'name'
,
'description'
,
'course'
,
'perfect_score'
,
]
widget_huli/widget_huli/settings.py
View file @
af90e4c6
...
@@ -61,7 +61,7 @@ ROOT_URLCONF = 'widget_huli.urls'
...
@@ -61,7 +61,7 @@ ROOT_URLCONF = 'widget_huli.urls'
TEMPLATES
=
[
TEMPLATES
=
[
{
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)
],
'APP_DIRS'
:
True
,
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'OPTIONS'
:
{
'context_processors'
:
[
'context_processors'
:
[
...
...
widget_huli/widget_huli/urls.py
View file @
af90e4c6
...
@@ -20,7 +20,6 @@ from django.urls import include, path
...
@@ -20,7 +20,6 @@ from django.urls import include, path
urlpatterns
=
[
urlpatterns
=
[
path
(
'forum/'
,
include
((
'forum.urls'
,
'forum'
),
namespace
=
"forum"
)),
path
(
'forum/'
,
include
((
'forum.urls'
,
'forum'
),
namespace
=
"forum"
)),
path
(
'assignments/'
,
include
((
'assignments.urls'
,
'assignments'
),
namespace
=
"assignments"
)),
path
(
'assignments/'
,
include
((
'assignments.urls'
,
'assignments'
),
namespace
=
"assignments"
)),
path
(
'Announcement_Board/'
,
include
((
'Announcement_Board.urls'
,
'Announcement_Board'
),
namespace
=
"Announcement_Board"
)),
path
(
'dashboard'
,
include
((
'dashboard.urls'
,
'dashboard'
),
namespace
=
"dashboard"
)),
path
(
'dashboard'
,
include
((
'dashboard.urls'
,
'dashboard'
),
namespace
=
"dashboard"
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
]
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