Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_placeholdername
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
Rajo Christian Cadorna
widget_placeholdername
Commits
e46ee65e
Commit
e46ee65e
authored
May 24, 2022
by
Rajo Christian Cadorna
Browse files
Options
Browse Files
Download
Plain Diff
Merge cadorna/assignments into master
parents
96f3f21d
67b8f287
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
56 additions
and
53 deletions
+56
-53
forms.cpython-310.pyc
assignments/__pycache__/forms.cpython-310.pyc
+0
-0
assignment.html
assignments/templates/assignment.html
+0
-16
assignment.html
assignments/templates/assignments/assignment.html
+0
-15
assignment_add.html
assignments/templates/assignments/assignment_add.html
+25
-0
assignment_detail.html
assignments/templates/assignments/assignment_detail.html
+11
-0
base.html
assignments/templates/assignments/base.html
+1
-1
index.html
assignments/templates/assignments/index.html
+2
-1
urls.py
assignments/urls.py
+4
-3
views.py
assignments/views.py
+13
-17
No files found.
assignments/__pycache__/forms.cpython-310.pyc
0 → 100644
View file @
e46ee65e
File added
assignments/templates/assignment.html
deleted
100644 → 0
View file @
96f3f21d
<!DOCTYPE html>
<html
lang=
"en"
>
<body>
<h1>
Assignments:
</h1>
{% for assignment in assignments %}
Assignment Name: {{assignment.name}}
<br>
Description: {{assignment.description}}
<br>
Perfect Score: {{assignment.max_points}}
<br>
Passing Score: {{assignment.passing_score}}
<br>
Course/Section: {{assignment.course.course_code}} | {{assignment.course.course_title}} | {{assignment.course.section}}
<br><br>
{% endfor %}
</body>
</html>
assignments/templates/assignments/assignment.html
deleted
100644 → 0
View file @
96f3f21d
{% extends "assignments/base.html" %}
{% block content %}
<h3>
{{assignment.course.course_code}} | {{assignment.course.course_title}} | {{assignment.course.section}}
</h3>
<hr>
<img
src=
{{assignment.assignment_imageUrl}}
>
<h2>
{{assignment.name}}
</h2>
Description: {{assignment.description}}
<br>
Perfect Score: {{assignment.max_points}}
<br>
Passing Score: {{assignment.passing_score}}
<br>
{% endblock %}
assignments/templates/assignments/assignment_add.html
0 → 100644
View file @
e46ee65e
{% extends "assignments/base.html" %}
{% block content %}
<h1>
New Assignment
</h1>
<hr>
<form
action=
"./"
method=
"post"
>
{% csrf_token %}
<label
for=
"name"
>
Name:
</label><br>
<input
type=
"text"
name=
"name"
id=
"name"
style=
"width:400px"
><br>
<label
for=
"description"
>
Description:
</label><br>
<textarea
name=
"description"
id=
"description"
style=
"width:400px; height:200px;"
></textarea><br>
<label
for=
"max_points"
>
Max Points:
</label><br>
<input
type=
"number"
name=
"max_points"
id=
"max_points"
><br>
<label
for=
"course"
>
Course:
</label><br>
<select
name=
"course"
id=
"course"
>
{% for course in course_list %}
<option
value=
"{{course}}"
>
{{course.course_title}}
</option>
{% endfor %}
</select><br>
<label
for=
"Image"
>
Image:
</label><br>
<input
type=
"text"
name=
"assignment_imageUrl"
id=
"assignment_imageUrl"
><br><br>
<input
type=
"submit"
value=
"Submit"
>
</form>
<h5><a
href =
"{% url 'assignments/index'%}"
>
Back to Assignments
</h5>
{% endblock %}
assignments/templates/assignments/assignment_detail.html
0 → 100644
View file @
e46ee65e
{% extends "assignments/base.html" %}
{% block content %}
<h3>
{{object.course.course_code}} | {{object.course.course_title}} | {{object.course.section}}
</h3>
<hr>
<img
src=
{{object.assignment_imageUrl}}
>
<h2>
{{object.name}}
</h2>
Description: {{object.description}}
<br>
Perfect Score: {{object.max_points}}
<br>
Passing Score: {{object.passing_score}}
<br>
{% endblock %}
assignments/templates/assignments/base.html
View file @
e46ee65e
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'assignments/style.css' %}"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'assignments/style.css' %}"
>
<title></title>
<title>
{% block title %}Assignments{% endblock %}
</title>
</head>
</head>
<body>
<body>
{% block content %}
{% block content %}
...
...
assignments/templates/assignments/
view
.html
→
assignments/templates/assignments/
index
.html
View file @
e46ee65e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<ul>
<ul>
{% for assignment in assignments %}
{% for assignment in assignments %}
{% if assignment.course.course_code == course.course_code %}
{% if assignment.course.course_code == course.course_code %}
<li><a
href =
"{% url 'assignment' assignment.id%}"
>
{{assignment.name}}
</a></li>
<li><a
href =
"{% url 'assignment
-detail
' assignment.id%}"
>
{{assignment.name}}
</a></li>
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</ul>
</ul>
...
@@ -19,5 +19,6 @@
...
@@ -19,5 +19,6 @@
{% else %}
{% else %}
<p>
No courses currently enrolled.
</p>
<p>
No courses currently enrolled.
</p>
{% endif %}
{% endif %}
<h5><a
href =
"{% url 'assignment-add'%}"
>
Create New Assignment
</h5>
{% endblock %}
{% endblock %}
assignments/urls.py
View file @
e46ee65e
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.views
import
HomePageView
,
AssignmentDetailView
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'
index'
),
path
(
''
,
HomePageView
.
as_view
(),
name
=
'assignments/
index'
),
path
(
"<int:assignment_id>/details/"
,
views
.
assignments
,
name
=
'assignment
'
)
path
(
'assignment/<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-detail
'
)
]
]
assignments/views.py
View file @
e46ee65e
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.
models
import
Assignment
,
Course
from
.
models
import
Assignment
,
Course
from
django.shortcuts
import
render
from
django.shortcuts
import
render
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
# Create your views here.
# Create your views here.
def
index
(
request
):
class
HomePageView
(
View
):
Assignments
=
Assignment
.
objects
.
all
()
def
get
(
self
,
request
):
Courses
=
Course
.
objects
.
all
()
assignments
=
Assignment
.
objects
.
all
()
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
context
=
{
context
=
{
'assignments'
:
Assignments
,
'assignments'
:
assignments
,
'courses'
:
Courses
,
'course_list'
:
course_list
'course_list'
:
course_list
}
}
return
render
(
request
,
"assignments/view
.html"
,
context
)
return
render
(
request
,
"assignments/index
.html"
,
context
)
def
assignments
(
request
,
assignment_id
):
class
AssignmentDetailView
(
DetailView
):
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
model
=
Assignment
try
:
assignment
=
Assignment
.
objects
.
get
(
pk
=
assignment_id
)
except
Assignment
.
DoesNotExist
:
raise
Http404
(
"Assignment does not exist"
)
return
render
(
request
,
"assignments/assignment.html"
,{
"assignment"
:
assignment
,
'course_list'
:
course_list
})
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