Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
final_quintupoltrobol
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
Matthew Karl David P. Arpas
final_quintupoltrobol
Commits
7b4fc362
Commit
7b4fc362
authored
May 13, 2023
by
Albert Gagalac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented assignment-add.html features
parent
6c4e976c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
9 deletions
+34
-9
models.py
widget_quintupoltrobol/assignments/models.py
+4
-0
assignment-add.html
...bol/assignments/templates/assignments/assignment-add.html
+16
-0
assignments.html
...trobol/assignments/templates/assignments/assignments.html
+5
-7
urls.py
widget_quintupoltrobol/assignments/urls.py
+3
-2
views.py
widget_quintupoltrobol/assignments/views.py
+6
-0
No files found.
widget_quintupoltrobol/assignments/models.py
View file @
7b4fc362
from
django.db
import
models
from
django.urls
import
reverse
from
django.core.validators
import
RegexValidator
# Create your models here.
...
...
@@ -24,6 +25,9 @@ class Assignment(models.Model):
course
=
models
.
ForeignKey
(
Course
,
on_delete
=
models
.
CASCADE
)
perfect_score
=
models
.
PositiveIntegerField
(
default
=
0
)
def
get_absolute_url
(
self
):
return
reverse
(
'assignments:assignment-details'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
__str__
(
self
):
return
self
.
name
...
...
widget_quintupoltrobol/assignments/templates/assignments/assignment-add.html
View file @
7b4fc362
{% extends 'base.html' %}
{% load static %}
{% block title %} Add Assignment {% endblock %}
{% block content %}
<h2>
Add a new Assignment:
</h2>
<p>
<form
action=
''
method=
"POST"
>
{% csrf_token %}
Name: {{form.name}}
<br><br>
Description:
<br>
{{form.description}}
<br><br>
Course: {{form.course}}
<br><br>
Perfect Score: {{form.perfect_score}}
<br><br>
<input
type=
"submit"
value=
"Add Assignment"
>
</form>
</p>
{% endblock %}
\ No newline at end of file
widget_quintupoltrobol/assignments/templates/assignments/assignments.html
View file @
7b4fc362
{% extends 'base.html' %}
{% load static %}
{% block title %} Widget's Assignments {% endblock %}
{% block content %}
<h2>
{{assignment.name}}
</h2>
<h3>
{{assignment.course}}
</h3>
<h2>
Welcome to Widget's Assignments!
</h2>
{% for data in assignment %}
<p>
Description: {{data.description}}
<br>
Perfect Score: {{data.perfect_score}}
<br>
Passing Score: {{data.passing_score}}
<br>
</p>
<p>
<a
href=
"{{ data.get_absolute_url }}"
>
{{ data }}
</a></p>
{% endfor %}
{% endblock %}
\ No newline at end of file
widget_quintupoltrobol/assignments/urls.py
View file @
7b4fc362
from
django.urls
import
path
from
.views
import
pageview
,
AssignmentDetailView
from
.views
import
pageview
,
AssignmentDetailView
,
AssignmentCreateView
urlpatterns
=
[
path
(
''
,
pageview
,
name
=
'pageview'
),
path
(
'<int:pk>/details'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
)
path
(
'<int:pk>/details'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
path
(
'add'
,
AssignmentCreateView
.
as_view
(),
name
=
'assignment-add'
),
]
app_name
=
"assignments"
\ No newline at end of file
widget_quintupoltrobol/assignments/views.py
View file @
7b4fc362
...
...
@@ -15,3 +15,9 @@ class AssignmentDetailView(DetailView):
course
=
assignment
.
course
return
render
(
request
,
'assignments/assignment-details.html'
,
{
'assignment'
:
assignment
,
'course'
:
course
})
class
AssignmentCreateView
(
CreateView
):
model
=
Assignment
fields
=
'__all__'
template_name
=
'assignments/assignment-add.html'
\ 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