Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 23
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
Bianca Aguilar
widget_group 23
Commits
ddcf5759
Commit
ddcf5759
authored
May 18, 2022
by
Bianca Aguilar
Browse files
Options
Browse Files
Download
Plain Diff
Updating local repo
parents
24513c2b
54290254
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
87 additions
and
35 deletions
+87
-35
models.py
assignments/models.py
+0
-10
assignment.html
assignments/templates/assignments/assignment.html
+26
-0
assignment_detail.html
assignments/templates/assignments/assignment_detail.html
+14
-0
urls.py
assignments/urls.py
+3
-2
views.py
assignments/views.py
+11
-22
db.sqlite3
db.sqlite3
+0
-0
settings.py
widget_group_23/settings.py
+2
-1
assignments_stylesheet.css
widget_group_23/static/css/assignments_stylesheet.css
+16
-0
base.html
widget_group_23/templates/base.html
+15
-0
No files found.
assignments/models.py
View file @
ddcf5759
...
...
@@ -27,16 +27,6 @@ class Assignment(models.Model):
@
property
def
passing_score
(
self
):
return
self
.
max_points
*
0.60
@
property
def
assignment_info
(
self
):
assignment
=
'<br>Assignment Name: {}'
.
format
(
self
.
name
)
assignment
+=
'<br>Description: {}'
.
format
(
self
.
description
)
assignment
+=
'<br>Perfect Score: {}'
.
format
(
self
.
max_points
)
assignment
+=
'<br>Passing Score: {}'
.
format
(
self
.
passing_score
)
assignment
+=
'<br>Course/Section: {}<br>'
.
format
(
self
.
course
.
course_info
)
return
assignment
def
__str__
(
self
):
return
'{} - {}'
.
format
(
self
.
name
,
self
.
course
.
course_shorthand
)
\ No newline at end of file
assignments/templates/assignments/assignment.html
0 → 100644
View file @
ddcf5759
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/assignments_stylesheet.css' %}"
>
{% endblock %}
{% block app_header %}Assignments Per Course{% endblock %}
{% block content %}
<ul>
{% for c in course_list %}
<li><p
class=
"course_section"
>
{{ c.course_code }} {{ c.course_title }} {{ c.section }}
</p>
<ul
class=
"course_assignments"
>
{% for a in assignment_list %}
{% if a.course.course_code == c.course_code %}
{% if a.course.section == c.section %}
<li><a
href=
"{% url 'assignments:assignment-detail' pk=a.pk %}"
>
{{ a.name }}
</a></li>
{% endif %}
{% endif %}
{% endfor %}
</ul>
</li>
{% endfor %}
</ul>
{% endblock %}
\ No newline at end of file
assignments/templates/assignments/assignment_detail.html
0 → 100644
View file @
ddcf5759
{% extends 'base.html' %}
{% load static %}
{% block styles %}
<link
rel=
"stylesheet"
href=
"{% static 'css/assignments_stylesheet.css' %}"
>
{% endblock %}
{% block content %}
<p
class=
"course"
>
{{ object.course.course_code }} {{ object.course.course_title }} {{ object.course.section }}
</p>
<p
class=
"title"
>
{{ object.name }}
</p>
<p
class=
"desc"
>
{{ object.description }}
</p>
<p
class=
"score"
>
Perfect Score: {{ object.max_points }}
</p>
<p
class=
"score"
>
Passing Score: {{ object.passing_score }}
</p>
{% endblock %}
\ No newline at end of file
assignments/urls.py
View file @
ddcf5759
from
django.urls
import
path
from
.views
import
index
from
.views
import
AssignmentsPageView
,
AssignmentDetailView
urlpatterns
=
[
path
(
''
,
index
,
name
=
"index"
),
path
(
''
,
AssignmentsPageView
.
as_view
(),
name
=
'index'
),
path
(
'<int:pk>/details'
,
AssignmentDetailView
.
as_view
(),
name
=
'assignment-detail'
),
]
app_name
=
"assignments"
\ No newline at end of file
assignments/views.py
View file @
ddcf5759
from
django.shortcuts
import
render
from
django.http
import
HttpResponse
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
.models
import
Assignment
from
.models
import
Assignment
,
Course
# Create your views here.
def
index
(
request
):
def
assignment_list
():
final_list
=
''
for
a
in
range
(
len
(
Assignment
.
objects
.
all
())):
final_list
+=
'{}'
.
format
(
Assignment
.
objects
.
get
(
pk
=
a
+
1
)
.
assignment_info
)
return
final_list
class
AssignmentsPageView
(
View
):
def
get
(
self
,
request
):
return
render
(
request
,
'assignments/assignment.html'
,
{
'course_list'
:
Course
.
objects
.
all
(),
'assignment_list'
:
Assignment
.
objects
.
all
()
})
html
=
f
'''
<html>
<body>
<header><h1>ASSIGNMENTS:</h1><header>
<main>
<p>{assignment_list()}</p>
</main>
</body>
</html>
'''
return
HttpResponse
(
html
)
\ No newline at end of file
class
AssignmentDetailView
(
DetailView
):
model
=
Assignment
\ No newline at end of file
db.sqlite3
View file @
ddcf5759
No preview for this file type
widget_group_23/settings.py
View file @
ddcf5759
...
...
@@ -62,7 +62,7 @@ ROOT_URLCONF = 'widget_group_23.urls'
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'templates'
)],
'DIRS'
:
[
os
.
path
.
join
(
BASE_DIR
,
'
widget_group_23/
templates'
)],
'APP_DIRS'
:
True
,
'OPTIONS'
:
{
'context_processors'
:
[
...
...
@@ -124,6 +124,7 @@ USE_TZ = True
# https://docs.djangoproject.com/en/4.0/howto/static-files/
STATIC_URL
=
'static/'
STATICFILES_DIRS
=
[
os
.
path
.
join
(
BASE_DIR
,
'widget_group_23/static'
)]
# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
...
...
widget_group_23/static/css/assignments_stylesheet.css
0 → 100644
View file @
ddcf5759
body
{
font-family
:
Tahoma
,
sans-serif
;
}
header
{
font-size
:
25px
;
font-weight
:
bold
;
}
.course_section
{
font-weight
:
bold
;
}
.course
,
.title
{
font-weight
:
bold
;
}
\ No newline at end of file
widget_group_23/templates/base.html
0 → 100644
View file @
ddcf5759
<html
lang=
"en"
>
<head>
<meta
charset =
"UTF-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<title>
Widget_23
</title>
{% block styles %}{% endblock %}
</head>
<body>
<header>
{% block app_header %}{% endblock %}
</header>
{% block content %}{% endblock %}
{% block scripts %}{% endblock %}
</body>
</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