Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Francoconuts
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Chester Tan
widget_Francoconuts
Commits
6a308741
Commit
6a308741
authored
May 17, 2022
by
Chester Tan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tan/assignments'
parents
118ce515
211b1649
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
10 deletions
+6
-10
urls.py
widget_Francoconuts/assignments/urls.py
+1
-1
views.py
widget_Francoconuts/assignments/views.py
+5
-9
No files found.
widget_Francoconuts/assignments/urls.py
View file @
6a308741
from
django.urls
import
path
from
.views
import
assignments
,
AssignmentDetailView
,
AssignmentListView
from
.views
import
AssignmentDetailView
,
AssignmentListView
urlpatterns
=
[
path
(
''
,
AssignmentListView
.
as_view
(),
name
=
'assignments'
),
...
...
widget_Francoconuts/assignments/views.py
View file @
6a308741
...
...
@@ -3,17 +3,13 @@ from .models import Assignment, Course
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
def
assignments
(
request
):
assignments_context
=
Assignment
.
objects
.
all
()
courses
=
Course
.
objects
.
order_by
(
'course_code'
)
context
=
{
'assignments'
:
assignments_context
,
'courses'
:
courses
,
}
return
render
(
request
,
'assignments/assignments.html'
,
context
)
class
AssignmentListView
(
ListView
):
model
=
Course
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
()
.
get_context_data
(
*
args
,
**
kwargs
)
context
[
"object_list"
]
=
Course
.
objects
.
order_by
(
"course_code"
)
return
context
class
AssignmentDetailView
(
DetailView
):
model
=
Assignment
\ 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