Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_tee jays angelos
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
Ramon Angelo Enriquez
widget_tee jays angelos
Commits
743f1df0
Commit
743f1df0
authored
May 17, 2022
by
Paul Angelo Sy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forms feature on Assignments
parent
653c019a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
1 deletion
+39
-1
views.cpython-310.pyc
...s_angelos/announcements/__pycache__/views.cpython-310.pyc
+0
-0
urls.cpython-310.pyc
...jays_angelos/assignments/__pycache__/urls.cpython-310.pyc
+0
-0
forms.py
widget_tee_jays_angelos/assignments/forms.py
+7
-0
add.html
...e_jays_angelos/assignments/templates/assignments/add.html
+15
-0
detail.html
...ays_angelos/assignments/templates/assignments/detail.html
+2
-0
index.html
...jays_angelos/assignments/templates/assignments/index.html
+1
-0
urls.py
widget_tee_jays_angelos/assignments/urls.py
+2
-0
views.py
widget_tee_jays_angelos/assignments/views.py
+12
-1
db.sqlite3
widget_tee_jays_angelos/db.sqlite3
+0
-0
settings.cpython-310.pyc
...get_tee_jays_angelos/__pycache__/settings.cpython-310.pyc
+0
-0
No files found.
widget_tee_jays_angelos/announcements/__pycache__/views.cpython-310.pyc
View file @
743f1df0
No preview for this file type
widget_tee_jays_angelos/assignments/__pycache__/urls.cpython-310.pyc
View file @
743f1df0
No preview for this file type
widget_tee_jays_angelos/assignments/forms.py
0 → 100644
View file @
743f1df0
from
django.forms
import
ModelForm
from
.models
import
Assignment
class
AssignmentForm
(
ModelForm
):
class
Meta
:
model
=
Assignment
fields
=
[
"name"
,
"description"
,
"max_points"
,
"course_code"
]
widget_tee_jays_angelos/assignments/templates/assignments/add.html
0 → 100644
View file @
743f1df0
{% extends 'base.html' %}
{% block head %}
{% load static %}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'assignments/style.css' %}"
>
{% endblock %}
{% block content %}
<h1>
New Assignment
</h1>
<form
action=
"{% url 'assignments:newAssignment' %}"
method =
"POST"
>
{% csrf_token %}
{{assignment_form.as_p}}
<button
class=
"button"
type=
"submit"
>
Save Assignment
</button>
</form>
<a
href=
"/assignments/"
>
<button>
Back to Assignments
</button>
</a>
{% endblock %}
widget_tee_jays_angelos/assignments/templates/assignments/detail.html
View file @
743f1df0
...
...
@@ -9,5 +9,7 @@
<li>
Description: {{assignment.description}}
</li>
<li>
Perfect Score: {{assignment.max_points}}
</li>
<li>
Passing Score: {{assignment.passing_score}}
</li>
<a
href=
"/assignments/"
>
<button>
Back to Assignments
</button>
</a>
<br>
<img
src=
"/static/assignments/{{assignment.name}}.jpg"
>
{% endblock %}
widget_tee_jays_angelos/assignments/templates/assignments/index.html
View file @
743f1df0
...
...
@@ -17,6 +17,7 @@
{% endfor %}
</li>
{% endfor %}
<a
href=
"/assignments/newAssignment"
>
<button>
Create an Assignment
</button>
</a>
{% else %}
<p>
No assignments are available
</p>
{% endif %}
...
...
widget_tee_jays_angelos/assignments/urls.py
View file @
743f1df0
...
...
@@ -2,7 +2,9 @@ from django.urls import path
from
.
import
views
app_name
=
"assignments"
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"assignments"
),
path
(
"<int:assignment_id>/details"
,
views
.
detail
,
name
=
"details"
),
path
(
'newAssignment'
,
views
.
newAssignment
,
name
=
"newAssignment"
)
]
widget_tee_jays_angelos/assignments/views.py
View file @
743f1df0
from
django.http
import
HttpResponse
,
Http404
from
assignments.models
import
Assignment
,
Course
from
django.shortcuts
import
render
from
django.shortcuts
import
render
,
redirect
from
django.template
import
loader
from
.forms
import
AssignmentForm
# Create your views here.
def
index
(
request
):
...
...
@@ -27,3 +28,13 @@ def detail(request, assignment_id):
"course"
:
course
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
def
newAssignment
(
request
):
if
request
.
method
==
"POST"
:
assignment_form
=
AssignmentForm
(
request
.
POST
)
if
assignment_form
.
is_valid
():
assignment_form
.
save
()
return
redirect
(
"assignments:newAssignment"
)
else
:
assignment_form
=
AssignmentForm
()
return
render
(
request
,
"assignments/add.html"
,
{
"assignment_form"
:
AssignmentForm
})
widget_tee_jays_angelos/db.sqlite3
View file @
743f1df0
No preview for this file type
widget_tee_jays_angelos/widget_tee_jays_angelos/__pycache__/settings.cpython-310.pyc
View file @
743f1df0
No preview for this file type
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