Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
midterm_princessgabi
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
Ysabella Panghulan
midterm_princessgabi
Commits
01f330f3
Commit
01f330f3
authored
May 12, 2023
by
Caryn Lopez-Go
Committed by
Ysabella Panghulan
May 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added templates and made edits to models, urls, and views.
parent
a483a340
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
108 additions
and
21 deletions
+108
-21
models.py
widget_princessgabi/assignments/models.py
+5
-1
assignment-add.html
...abi/assignments/templates/assignments/assignment-add.html
+10
-0
assignment-details.html
...assignments/templates/assignments/assignment-details.html
+14
-0
assignment-edit.html
...bi/assignments/templates/assignments/assignment-edit.html
+10
-0
assignments.html
...ssgabi/assignments/templates/assignments/assignments.html
+19
-0
assingments.html
...ssgabi/assignments/templates/assignments/assingments.html
+19
-0
urls.py
widget_princessgabi/assignments/urls.py
+7
-2
views.py
widget_princessgabi/assignments/views.py
+24
-18
No files found.
widget_princessgabi/assignments/models.py
View file @
01f330f3
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
# Create your models here.
class
Course
(
models
.
Model
):
class
Course
(
models
.
Model
):
...
@@ -20,4 +21,7 @@ class Assignment(models.Model):
...
@@ -20,4 +21,7 @@ class Assignment(models.Model):
return
round
(
self
.
perfect_score
*
0.6
)
return
round
(
self
.
perfect_score
*
0.6
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
\ No newline at end of file
def
get_absolute_url
(
self
):
return
reverse
(
"assignments:assignment-details"
,
kwargs
=
{
"pk"
:
self
.
pk
})
\ No newline at end of file
widget_princessgabi/assignments/templates/assignments/assignment-add.html
0 → 100644
View file @
01f330f3
{% extends 'base.html' %}
{% block title %}Add Assignment{% endblock %}
{% block header %}Add a new assignment:{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"SUBMIT"
value=
"Save New Assignment"
>
</form>
{% endblock %}
\ No newline at end of file
widget_princessgabi/assignments/templates/assignments/assignment-details.html
0 → 100644
View file @
01f330f3
{% extends 'base.html' %}
{% block title %}{{ assignment.name }}{% endblock %}
{% block heading %}{{ assignment.name }}{% endblock %}
{% block content %}
<p>
{{ assignment.course.code }} {{ assignment.course.title }} - {{ assignment.course.section }}
<br>
Description: {{ assignment.description }}
<br>
Perfert Score: {{ assignment.perfect_score }}
<br>
Passing Score: {{ assignment.passing_score }}
</p>
<a
href=
"{% url 'assignments:assignment-edit' assignment.id %}"
>
<button>
Edit Assignment
</button>
</a><br>
{% endblock %}
\ No newline at end of file
widget_princessgabi/assignments/templates/assignments/assignment-edit.html
0 → 100644
View file @
01f330f3
{% extends 'base.html' %}
{% block title %}Edit Assignment{% endblock %}
{% block header %}Edit Assignment:{% endblock %}
{% block content %}
<form
method=
"POST"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"SUBMIT"
value=
"Save Changes to Assignment"
>
</form>
{% endblock %}
\ No newline at end of file
widget_princessgabi/assignments/templates/assignments/assignments.html
0 → 100644
View file @
01f330f3
{% extends 'base.html' %}
{% block title %}Widget's Assignments{% endblock %}
{% block heading %}Welcome to Widget's Assignments{% endblock %}
{% block content %}
<ul>
{% for assignment in assignments %}
<li>
<a
href=
"{ assignment.get_absolute_url }"
></a>
</li>
{% endfor %}
<a
href=
"{% url 'assignments:assignment-add' %}"
>
<button>
New Assignment
</button>
</a><br>
</ul>
<a
href=
"{% url 'dashboard:dashboard' %}"
>
Dashboard
</a><br>
<a
href=
"{% url 'announcements:announcements' %}"
>
Announcements
</a><br>
<a
href=
"{% url 'forum:forum' %}"
>
Forum
</a><br>
<a
href=
"{% url 'calendar:calendar' %}"
>
Calendar
</a>
{% endblock %}
\ No newline at end of file
widget_princessgabi/assignments/templates/assignments/assingments.html
0 → 100644
View file @
01f330f3
{% extends 'base.html' %}
{% block title %}Widget's Assignments{% endblock %}
{% block heading %}Welcome to Widget's Assignments{% endblock %}
{% block content %}
<ul>
{% for assignment in assignments %}
<li>
<a
href=
"{ assignment.get_absolute_url }"
></a>
</li>
{% endfor %}
<a
href=
"{% url 'add-assignment' assignment.id %}"
>
<button>
{{ assignment.title }}
</button>
</a><br>
</ul>
<a
href=
"{% url 'dashboard:dashboard' %}"
>
Dashboard
</a><br>
<a
href=
"{% url 'announcements:announcements' %}"
>
Announcements
</a><br>
<a
href=
"{% url 'forum:forum' %}"
>
Forum
</a><br>
<a
href=
"{% url 'calendar:calendar' %}"
>
Calendar
</a>
{% endblock %}
\ No newline at end of file
widget_princessgabi/assignments/urls.py
View file @
01f330f3
from
django.urls
import
path
from
django.urls
import
path
from
.
import
views
from
.
import
views
from
.views
import
*
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
assignments
,
name
=
"assignments"
),
path
(
''
,
views
.
Assignments
,
name
=
"assignments"
),
]
path
(
'<int:pk>/details/'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-details'
),
\ No newline at end of file
path
(
'add/'
,
AssignmentCreateView
.
as_view
(),
name
=
'assignment-add'
),
path
(
'<int:pk>/edit/'
,
AssignmentUpdateView
.
as_view
(),
name
=
'assignment-edit'
),
]
app_name
=
'assignments'
\ No newline at end of file
widget_princessgabi/assignments/views.py
View file @
01f330f3
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
Assignment
,
Course
from
.models
import
Assignment
,
Course
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.shortcuts
import
render
from
django.template
import
loader
# Create your views here.
def
Assignments
(
request
):
def
assignments
(
request
):
assignments
=
Assignment
.
objects
.
all
()
homeworks
=
Assignment
.
objects
.
all
()
context
=
{
display
=
'Widget
\'
s Assignments Page<br><br>'
'assignments'
:
assignments
,
for
homework
in
homeworks
:
}
assignment_name
=
homework
.
name
return
render
(
request
,
'assignments/assignments.html'
,
context
)
assignment_description
=
homework
.
description
assignment_perfect_score
=
homework
.
perfect_score
assignment_passing_score
=
homework
.
passing_score
course_code
=
homework
.
course
.
code
course_title
=
homework
.
course
.
title
course_section
=
homework
.
course
.
section
display
+=
'Assignment Name: '
+
assignment_name
+
'<br>'
class
AssignmentDetailView
(
DetailView
):
display
+=
'Description: '
+
assignment_description
+
'<br>'
model
=
Assignment
display
+=
'Perfect Score: '
+
str
(
assignment_perfect_score
)
+
'<br>'
template_name
=
'assignments/assignment-details.html'
display
+=
'Passing Score: '
+
str
(
assignment_passing_score
)
+
'<br>'
display
+=
'Course/Section: '
+
course_code
+
' '
+
course_title
+
'-'
+
course_section
+
'<br><br>'
class
AssignmentCreateView
(
CreateView
):
return
HttpResponse
(
display
)
model
=
Assignment
\ No newline at end of file
fields
=
'__all__'
template_name
=
'assignments/assignment-add.html'
class
AssignmentUpdateView
(
UpdateView
):
model
=
Assignment
fields
=
'__all__'
template_name
=
'assignments/assignment-edit.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