Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group 6
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
Patricia Isabella Nava
widget_group 6
Commits
4ee1db9b
Commit
4ee1db9b
authored
May 10, 2022
by
Patricia Isabella Nava
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'nava/assignments'
parents
5113bb1b
aa5cfd9a
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
125 additions
and
25 deletions
+125
-25
models.py
widget_group_6/assignments/models.py
+2
-0
history.jpg
...group_6/assignments/static/assignments/images/history.jpg
+0
-0
koreanlang.png
...up_6/assignments/static/assignments/images/koreanlang.png
+0
-0
yoga.jpg
...et_group_6/assignments/static/assignments/images/yoga.jpg
+0
-0
style.css
widget_group_6/assignments/static/assignments/style.css
+40
-0
base.html
widget_group_6/assignments/templates/assignments/base.html
+16
-0
detail.html
widget_group_6/assignments/templates/assignments/detail.html
+25
-0
index.html
widget_group_6/assignments/templates/assignments/index.html
+26
-17
urls.py
widget_group_6/assignments/urls.py
+3
-1
views.py
widget_group_6/assignments/views.py
+13
-7
No files found.
widget_group_6/assignments/models.py
View file @
4ee1db9b
...
...
@@ -2,6 +2,8 @@ from pyexpat import model
from
django.db
import
models
from
django.core.validators
import
RegexValidator
# Create your models here.
class
Course
(
models
.
Model
):
course_code
=
models
.
CharField
(
max_length
=
10
)
...
...
widget_group_6/assignments/static/assignments/images/history.jpg
0 → 100644
View file @
4ee1db9b
9.81 KB
widget_group_6/assignments/static/assignments/images/koreanlang.png
0 → 100644
View file @
4ee1db9b
342 KB
widget_group_6/assignments/static/assignments/images/yoga.jpg
0 → 100644
View file @
4ee1db9b
38 KB
widget_group_6/assignments/static/assignments/style.css
0 → 100644
View file @
4ee1db9b
h1
{
color
:
purple
;
font-weight
:
bold
;
font-family
:
'Segoe UI'
,
Tahoma
,
Geneva
,
Verdana
,
sans-serif
;
}
p
,
ul
{
color
:
darkolivegreen
;
font-size
:
24px
;
margin-bottom
:
15px
;
display
:
block
;
text-align
:
justify
;
font-family
:
Georgia
,
'Times New Roman'
,
Times
,
serif
;
}
body
{
background-color
:
rgb
(
255
,
225
,
182
);
}
a
{
color
:
blueviolet
;
}
a
:visited
{
color
:
brown
;
}
a
:hover
{
color
:
orangered
;
}
img
{
display
:
block
;
margin-left
:
auto
;
margin-right
:
auto
;
width
:
50%
;
}
widget_group_6/assignments/templates/assignments/base.html
0 → 100644
View file @
4ee1db9b
{% load static %}
<!DOCTYPE html>
<html
lang =
"en"
>
<head>
<link
rel =
"stylesheet"
type=
"text/css"
href=
"{% static 'assignments/style.css' %}"
>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE-edge"
>
<meta
name =
"viewport"
content=
"width-device width, initial scale=1.0"
>
<title>
Assignments
</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
\ No newline at end of file
widget_group_6/assignments/templates/assignments/detail.html
0 → 100644
View file @
4ee1db9b
{% extends "assignments/base.html" %}
{% load static %}
{% block content %}
<h1>
{{assignment.course.course_code}} {{assignment.course.course_title}} {{assignment.course.section}}
</h1>
<p>
{{assignment.name}}
<br>
{{assignment.description}}
<br>
{{assignment.max_points}}
<br>
{{assignment.passing_score}}
<br>
{% if assignment.id == 1 %}
<img
src =
"{% static 'assignments/images/history.jpg' %}"
alt =
"history"
>
{% elif assignment.id == 2 %}
<img
src =
"{% static 'assignments/images/koreanlang.png' %}"
alt =
"korean speaking"
>
{% else %}
<img
src =
"{% static 'assignments/images/yoga.jpg' %}"
alt =
"yoga"
>
{% endif %}
</p>
{% endblock %}
\ No newline at end of file
widget_group_6/assignments/templates/assignments/index.html
View file @
4ee1db9b
<!DOCTYPE html>
<html>
<head></head>
<body>
<h1>
ASSIGNMENTS:
</h1>
{% for assignment in assignment_entries %}
<p>
Assignment Name: {{assignment.name}}
<br>
Description: {{assignment.description}}
<br>
Perfect Score: {{assignment.max_points}}
<br>
Passing Score: {{assignment.passing_score}}
<br>
Course/Section: {{assignment.course.course_code}} {{assignment.course.course_title}} | {{assignment.course.section}}
</p>
{% endfor %}
</body>
</html>
{% extends "assignments/base.html" %}
{% block content %}
<h1>
Assignments Per Course
</h1>
<p>
List of All Courses:
<br>
{% for course in course_list %}
<ul>
<li>
{{course.course_code}} {{course.course_title}} {{course.section}}
</li>
{% for assignment in course.assignment_set.all %}
<ul>
<li>
<a
href =
"{% url 'assignments:detail' assignment.id %}"
>
{{assignment.name}}
</a>
</li>
</ul>
{% endfor %}
</ul>
{% endfor %}
</p>
{% endblock %}
widget_group_6/assignments/urls.py
View file @
4ee1db9b
from
django.urls
import
path
from
django.urls
import
path
,
include
from
.
import
views
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'index'
),
#assignments/1/details
path
(
"<int:assignment_id>/details/"
,
views
.
detail
,
name
=
'detail'
),
]
app_name
=
"assignments"
\ No newline at end of file
widget_group_6/assignments/views.py
View file @
4ee1db9b
from
django.http
import
HttpResponse
from
django.template
import
loader
from
unicodedata
import
name
from
django.http
import
Http404
,
HttpResponse
from
django.shortcuts
import
render
,
redirect
from
.models
import
Course
,
Assignment
# Create your views here.
def
index
(
request
):
assignments
=
Assignment
.
objects
.
all
()
template
=
loader
.
get_template
(
'assignments/index.html'
)
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
context
=
{
'
assignment_entries'
:
assignments
'
course_list'
:
course_list
}
return
HttpResponse
(
template
.
render
(
context
,
request
))
return
render
(
request
,
"assignments/index.html"
,
context
)
def
detail
(
request
,
assignment_id
):
try
:
assignment
=
Assignment
.
objects
.
get
(
pk
=
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
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