Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_Alipins
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
Angelico Ruiz T. Teaño
widget_Alipins
Commits
2ffc327a
Commit
2ffc327a
authored
May 22, 2022
by
Angelico Ruiz T. Teaño
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option for user to add new assignment
parent
408687f5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
7 deletions
+37
-7
add.html
widget_alipins/assignments/templates/assignments/add.html
+23
-0
index.html
widget_alipins/assignments/templates/assignments/index.html
+4
-1
urls.py
widget_alipins/assignments/urls.py
+2
-2
views.py
widget_alipins/assignments/views.py
+8
-4
No files found.
widget_alipins/assignments/templates/assignments/add.html
0 → 100644
View file @
2ffc327a
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'assignments/style.css' %}"
>
{% endblock %}
{% block title %}New Assignment{% endblock %}
{% block content %}
<h1>
New Assignment
</h1>
<div>
<form
method=
"POST"
enctype=
"multipart/form-data"
>
{% csrf_token %}
Assignment name: {{ form.name }}
<br>
Description:
<br>
{{ form.description }}
<br>
Max points: {{ form.max_points }}
<br>
Course Code/Course Title/Section: {{ form.course }}
<br>
Image: {{ form.assignment_image}}
<br>
<input
type=
"submit"
value=
"Save Assignment"
>
</form>
</div>
{% endblock %}
\ No newline at end of file
widget_alipins/assignments/templates/assignments/index.html
View file @
2ffc327a
...
...
@@ -21,11 +21,14 @@
</ul>
{% endif %}
{% endfor %}
<br>
<br>
<br>
{% endfor %}
</ul>
{% else %}
<p>
There are no assignments under any course.
</p>
{% endif %}
<a
href=
"{% url 'assignments:addAssignment' %}"
>
<button>
New Assignment
</button>
</a>
</div>
{% endblock %}
\ No newline at end of file
widget_alipins/assignments/urls.py
View file @
2ffc327a
from
django.urls
import
path
from
.
import
views
app_name
=
"assignments"
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"indexAssignments"
),
path
(
'<int:assignment_id>/details'
,
views
.
details
,
name
=
"details"
)
path
(
'<int:assignment_id>/details'
,
views
.
details
,
name
=
"details"
),
path
(
'add'
,
views
.
addAssignment
.
as_view
(),
name
=
"addAssignment"
),
]
\ No newline at end of file
widget_alipins/assignments/views.py
View file @
2ffc327a
from
ast
import
Assign
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
Http404
from
django.shortcuts
import
render
from
.models
import
Assignment
,
Course
from
django.views.generic
import
CreateView
# Create your views here.
def
index
(
request
):
...
...
@@ -21,4 +20,9 @@ def details(request, assignment_id):
except
Assignment
.
DoesNotExist
:
raise
Http404
(
"Assignment does not exist!"
)
return
render
(
request
,
"assignments/detail.html"
,
{
"assignment"
:
assignment
})
\ No newline at end of file
return
render
(
request
,
"assignments/detail.html"
,
{
"assignment"
:
assignment
})
class
addAssignment
(
CreateView
):
model
=
Assignment
template_name
=
"assignments/add.html"
fields
=
[
'name'
,
'description'
,
'max_points'
,
'course'
,
'assignment_image'
]
\ 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