Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group17
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
Vaughn Nephi Fajardo
widget_group17
Commits
eea7aedf
Commit
eea7aedf
authored
May 24, 2022
by
Joan Denise Nocos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: converted index view from function-based (FBV) to class-based (CBV)
parent
c2f3028e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
11 deletions
+27
-11
forms.cpython-39.pyc
widget_group_17/assignments/__pycache__/forms.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
widget_group_17/assignments/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
widget_group_17/assignments/__pycache__/views.cpython-39.pyc
+0
-0
urls.py
widget_group_17/assignments/urls.py
+2
-1
views.py
widget_group_17/assignments/views.py
+25
-10
No files found.
widget_group_17/assignments/__pycache__/forms.cpython-39.pyc
View file @
eea7aedf
No preview for this file type
widget_group_17/assignments/__pycache__/urls.cpython-39.pyc
View file @
eea7aedf
No preview for this file type
widget_group_17/assignments/__pycache__/views.cpython-39.pyc
View file @
eea7aedf
No preview for this file type
widget_group_17/assignments/urls.py
View file @
eea7aedf
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
IndexView
app_name
=
"assignments"
app_name
=
"assignments"
urlpatterns
=
[
urlpatterns
=
[
# assignments/
# assignments/
path
(
''
,
views
.
index
,
name
=
'index'
),
path
(
''
,
IndexView
.
as_view
()
,
name
=
'index'
),
# assignments/<assignment_id>/details/
# assignments/<assignment_id>/details/
path
(
'<int:assignment_id>/details/'
,
views
.
details
,
name
=
'details'
),
path
(
'<int:assignment_id>/details/'
,
views
.
details
,
name
=
'details'
),
# assignments/add/
# assignments/add/
...
...
widget_group_17/assignments/views.py
View file @
eea7aedf
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views
import
View
from
assignments.models
import
Assignment
,
Course
from
assignments.models
import
Assignment
,
Course
from
assignments.forms
import
AssignmentForm
from
assignments.forms
import
AssignmentForm
# Create your views here.
# Create your views here.
def
index
(
request
):
class
IndexView
(
View
):
def
get
(
self
,
request
):
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
assignment_list
=
Assignment
.
objects
.
all
()
assignment_list
=
Assignment
.
objects
.
all
()
context
=
{
context
=
{
...
@@ -38,7 +40,20 @@ def newassignment(request):
...
@@ -38,7 +40,20 @@ def newassignment(request):
assignment_form
=
AssignmentForm
()
assignment_form
=
AssignmentForm
()
return
render
(
request
,
"assignments/newassignment.html"
,
{
"assignment_form"
:
assignment_form
})
return
render
(
request
,
"assignments/newassignment.html"
,
{
"assignment_form"
:
assignment_form
})
# Code from previous labs:
# Code from Lab 3:
#
# def index(request):
# course_list = Course.objects.order_by("course_code")
# assignment_list = Assignment.objects.all()
# context = {
# "course_list" : course_list,
# "assignment_list" : assignment_list,
# }
# return render(request, "assignments/index.html", context)
# Code from Midterm Project and earlier labs:
#
#
# def index(request):
# def index(request):
# assignments_view = "ASSIGNMENTS: <br>"
# assignments_view = "ASSIGNMENTS: <br>"
...
...
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