Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_group17
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
Vaughn Nephi Fajardo
widget_group17
Commits
2e0f4a51
Commit
2e0f4a51
authored
May 19, 2022
by
Joan Denise Nocos
Browse files
Options
Browse Files
Download
Plain Diff
fix: resolved merge conflicts
parents
ab067941
9b64c645
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
177 additions
and
18 deletions
+177
-18
0005_assignment_image.py
..._group_17/assignments/migrations/0005_assignment_image.py
+18
-0
0006_alter_assignment_image.py
..._17/assignments/migrations/0006_alter_assignment_image.py
+18
-0
0005_assignment_image.cpython-39.pyc
...grations/__pycache__/0005_assignment_image.cpython-39.pyc
+0
-0
0006_alter_assignment_image.cpython-39.pyc
...ns/__pycache__/0006_alter_assignment_image.cpython-39.pyc
+0
-0
models.py
widget_group_17/assignments/models.py
+5
-1
Assignment-1-image.png
..._17/assignments/static/assignments/Assignment-1-image.png
+0
-0
Assignment-2-image.png
..._17/assignments/static/assignments/Assignment-2-image.png
+0
-0
Assignment-3-image.png
..._17/assignments/static/assignments/Assignment-3-image.png
+0
-0
Assignment-4-image.png
..._17/assignments/static/assignments/Assignment-4-image.png
+0
-0
style.css
widget_group_17/assignments/static/assignments/style.css
+35
-0
base.html
widget_group_17/assignments/templates/assignments/base.html
+17
-0
details.html
...t_group_17/assignments/templates/assignments/details.html
+12
-0
index.html
widget_group_17/assignments/templates/assignments/index.html
+24
-0
urls.py
widget_group_17/assignments/urls.py
+5
-1
views.py
widget_group_17/assignments/views.py
+43
-16
No files found.
widget_group_17/assignments/migrations/0005_assignment_image.py
0 → 100644
View file @
2e0f4a51
# Generated by Django 3.2.12 on 2022-05-18 07:45
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0004_auto_20220406_0329'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'image'
,
field
=
models
.
FileField
(
null
=
True
,
upload_to
=
'static/'
),
),
]
widget_group_17/assignments/migrations/0006_alter_assignment_image.py
0 → 100644
View file @
2e0f4a51
# Generated by Django 3.2.12 on 2022-05-19 01:53
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0005_assignment_image'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'assignment'
,
name
=
'image'
,
field
=
models
.
FileField
(
null
=
True
,
upload_to
=
'static/assignments/'
),
),
]
widget_group_17/assignments/migrations/__pycache__/0005_assignment_image.cpython-39.pyc
0 → 100644
View file @
2e0f4a51
File added
widget_group_17/assignments/migrations/__pycache__/0006_alter_assignment_image.cpython-39.pyc
0 → 100644
View file @
2e0f4a51
File added
widget_group_17/assignments/models.py
View file @
2e0f4a51
from
django.db
import
models
import
os
# Create your models here.
class
Course
(
models
.
Model
):
...
...
@@ -12,8 +13,11 @@ class Assignment(models.Model):
description
=
models
.
CharField
(
max_length
=
500
)
max_points
=
models
.
IntegerField
(
default
=
0
)
passing_score
=
models
.
IntegerField
(
default
=
0
)
image
=
models
.
FileField
(
upload_to
=
'static/assignments/'
,
null
=
True
)
def
_str_
(
self
):
return
self
.
name
\ No newline at end of file
def
file
(
self
):
value
=
os
.
path
.
basename
(
self
.
image
.
name
)
return
value
\ No newline at end of file
widget_group_17/assignments/static/assignments/Assignment-1-image.png
0 → 100644
View file @
2e0f4a51
34.5 KB
widget_group_17/assignments/static/assignments/Assignment-2-image.png
0 → 100644
View file @
2e0f4a51
40 KB
widget_group_17/assignments/static/assignments/Assignment-3-image.png
0 → 100644
View file @
2e0f4a51
30.4 KB
widget_group_17/assignments/static/assignments/Assignment-4-image.png
0 → 100644
View file @
2e0f4a51
28.2 KB
widget_group_17/assignments/static/assignments/style.css
0 → 100644
View file @
2e0f4a51
h1
{
position
:
sticky
;
text-align
:
center
;
color
:
purple
;
font-size
:
55px
;
font-family
:
Georgia
;
}
h2
{
color
:
purple
;
font-size
:
30px
;
font-family
:
Georgia
;
}
h3
{
color
:
black
;
font-weight
:
bold
;
font-family
:
Courier
New
;
font-size
:
25px
;
}
p
{
color
:
black
;
font-family
:
Helvetica
;
font-size
:
20px
;
}
body
{
background-color
:
white
;
}
a
{
color
:
blue
;
font-family
:
Courier
New
;
font-size
:
20px
;
font-weight
:
bold
;
}
a
:link
{
text-decoration
:
underline
;
}
\ No newline at end of file
widget_group_17/assignments/templates/assignments/base.html
0 → 100644
View file @
2e0f4a51
{% load static %}
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'assignments/style.css' %}"
>
<title>
{% block page-title %}{% endblock %}
</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
widget_group_17/assignments/templates/assignments/details.html
0 → 100644
View file @
2e0f4a51
{% extends "assignments/base.html" %}
{% block page-title %}Assignment {{ assignment_id }} Details{% endblock %}
{% block content %}
<h1>
{{ course.course_code }} {{ course.course_title }} {{ course.section }}
</h1>
<h3>
{{ assignment.name }}
</h3>
<p>
Description: {{ assignment.description }}
</p>
<p>
Perfect Score: {{ assignment.max_points }}
</p>
<p>
Passing Score: {{ assignment.passing_score }}
</p>
<img
src=
"/static/assignments/{{ assignment.file }}"
width=
"250"
height=
"250"
>
{% endblock %}
\ No newline at end of file
widget_group_17/assignments/templates/assignments/index.html
0 → 100644
View file @
2e0f4a51
{% extends "assignments/base.html" %}
{% block page-title %}Assignments Per Course{% endblock %}
{% block content %}
<h1>
Assignments Per Course
</h1>
<h2>
List of courses:
</h2>
{% if course_list %}
<ul>
{% for course in course_list %}
<li><h3>
{{ course.course_code }} {{ course.course_title }} {{ course.section }}
</h3></li>
<ul>
{% for assignment in assignment_list %}
{% if assignment.course == course %}
<li><a
href=
"{% url 'assignments:details' assignment.id %}"
>
{{ assignment.name }}
</a></li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
</ul>
{% else %}
<p>
No course available.
</p>
{% endif %}
{% endblock %}
\ No newline at end of file
widget_group_17/assignments/urls.py
View file @
2e0f4a51
...
...
@@ -2,6 +2,10 @@ from django.urls import path
from
.
import
views
app_name
=
"assignments"
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'index'
)
# assignments/
path
(
''
,
views
.
index
,
name
=
'index'
),
# assignments/<assignment_id>/details/
path
(
'<int:assignment_id>/details/'
,
views
.
details
,
name
=
'details'
),
]
\ No newline at end of file
widget_group_17/assignments/views.py
View file @
2e0f4a51
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
assignments.models
import
Assignment
,
Course
# Create your views here.
def
index
(
request
):
assignments_view
=
"ASSIGNMENTS: <br>"
schoolwork
=
Assignment
.
objects
.
all
()
for
assignment
in
schoolwork
:
score
=
assignment
.
max_points
assignment
.
passing_score
=
(
score
*
60
)
//
100
assignments_view
+=
"Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {} {}<br><br>"
.
\
format
(
assignment
.
name
,
assignment
.
description
,
assignment
.
max_points
,
assignment
.
passing_score
,
assignment
.
course
.
course_code
,
assignment
.
course
.
course_title
,
assignment
.
course
.
section
)
return
HttpResponse
(
assignments_view
)
\ No newline at end of file
course_list
=
Course
.
objects
.
order_by
(
"course_code"
)
assignment_list
=
Assignment
.
objects
.
all
()
context
=
{
"course_list"
:
course_list
,
"assignment_list"
:
assignment_list
,
}
return
render
(
request
,
"assignments/index.html"
,
context
)
def
details
(
request
,
assignment_id
):
try
:
assignment
=
Assignment
.
objects
.
get
(
pk
=
assignment_id
)
except
Assignment
.
DoesNotExist
:
raise
Http404
(
"Assignment does not exist."
)
score
=
assignment
.
max_points
assignment
.
passing_score
=
(
score
*
60
)
//
100
context
=
{
"assignment"
:
assignment
,
"course"
:
assignment
.
course
,
}
return
render
(
request
,
"assignments/details.html"
,
context
)
# Code from previous labs:
#
# def index(request):
# assignments_view = "ASSIGNMENTS: <br>"
# schoolwork = Assignment.objects.all()
# for assignment in schoolwork:
# score = assignment.max_points
# assignment.passing_score = (score*60) // 100
# assignments_view += "Assignment Name: {}<br>Description: {}<br>Perfect Score: {}<br>Passing Score: {}<br>Course/Section: {} {} {}<br><br>".\
# format(assignment.name,
# assignment.description,
# assignment.max_points,
# assignment.passing_score,
# assignment.course.course_code,
# assignment.course.course_title,
# assignment.course.section)
#
# return HttpResponse(assignments_view)
\ 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