Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_someone here is possessed by an owl
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
Laetitia de Castro
widget_someone here is possessed by an owl
Commits
6b789112
Commit
6b789112
authored
May 26, 2022
by
kylemendozaa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted the index funtion to a cbv
parent
b18c3340
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
9 deletions
+11
-9
urls.cpython-39.pyc
assignments/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
assignments/__pycache__/views.cpython-39.pyc
+0
-0
assignment_detail.html
assignments/templates/assignments/assignment_detail.html
+1
-1
urls.py
assignments/urls.py
+2
-2
views.py
assignments/views.py
+8
-6
No files found.
assignments/__pycache__/urls.cpython-39.pyc
View file @
6b789112
No preview for this file type
assignments/__pycache__/views.cpython-39.pyc
View file @
6b789112
No preview for this file type
assignments/templates/assignments/assignment_detail.html
View file @
6b789112
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
<img
src=
"{% static 'assignment1.jpg' %}"
>
<img
src=
"{% static 'assignment1.jpg' %}"
>
{% elif assignment.id == 2 %}
{% elif assignment.id == 2 %}
<img
src=
"{% static 'assignment2.jpg' %}"
>
<img
src=
"{% static 'assignment2.jpg' %}"
>
{% elif assigment.id == 3 %}
{% elif assig
n
ment.id == 3 %}
<img
src=
"{% static 'code.jpg' %}"
>
<img
src=
"{% static 'code.jpg' %}"
>
{% endif %}
{% endif %}
...
...
assignments/urls.py
View file @
6b789112
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
index
,
AssignmentDetailView
,
new_assignment
from
.views
import
IndexView
,
AssignmentDetailView
,
new_assignment
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
index
,
name
=
'index'
),
path
(
''
,
IndexView
.
as_view
()
,
name
=
'index'
),
path
(
'<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
path
(
'<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
path
(
'add/'
,
new_assignment
,
name
=
'new-assignment'
)
path
(
'add/'
,
new_assignment
,
name
=
'new-assignment'
)
]
]
...
...
assignments/views.py
View file @
6b789112
...
@@ -2,13 +2,15 @@ from django.shortcuts import render, redirect
...
@@ -2,13 +2,15 @@ from django.shortcuts import render, redirect
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.template
import
loader
from
django.template
import
loader
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.base
import
TemplateView
from
.models
import
Assignment
,
Course
from
.models
import
Assignment
,
Course
from
.forms
import
AssignmentForm
from
.forms
import
AssignmentForm
# Create your views here.
# Create your views here.
def
index
(
request
):
class
IndexView
(
TemplateView
):
def
get
(
self
,
request
):
context
=
{
context
=
{
"courses"
:
Course
.
objects
.
order_by
(
"course_code"
),
"courses"
:
Course
.
objects
.
order_by
(
"course_code"
),
}
}
...
...
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