Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_jupert
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
Joseph Izon
widget_jupert
Commits
793f6929
Commit
793f6929
authored
May 26, 2022
by
Jeremy Factor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add migration files for model updates
parent
45d99d3f
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
165 additions
and
7 deletions
+165
-7
0003_announcement_image.cpython-39.pyc
...ations/__pycache__/0003_announcement_image.cpython-39.pyc
+0
-0
0003_assignment_image.py
...et_jupert/assignments/migrations/0003_assignment_image.py
+18
-0
0003_assignment_image.cpython-39.pyc
...grations/__pycache__/0003_assignment_image.cpython-39.pyc
+0
-0
models.py
widget_jupert/assignments/models.py
+1
-1
Jose-Rizal120161230.jpg
...rt/assignments/static/assignments/Jose-Rizal120161230.jpg
+0
-0
algebra-review.jpg
..._jupert/assignments/static/assignments/algebra-review.jpg
+0
-0
style.css
widget_jupert/assignments/static/assignments/style.css
+44
-0
whatisacomputer_desktop_computers.jpg
.../static/assignments/whatisacomputer_desktop_computers.jpg
+0
-0
base.html
widget_jupert/assignments/templates/assignments/base.html
+22
-0
details.html
widget_jupert/assignments/templates/assignments/details.html
+17
-0
index.html
widget_jupert/assignments/templates/assignments/index.html
+27
-0
urls.py
widget_jupert/assignments/urls.py
+8
-3
views.py
widget_jupert/assignments/views.py
+28
-3
No files found.
widget_jupert/announcements/migrations/__pycache__/0003_announcement_image.cpython-39.pyc
0 → 100644
View file @
793f6929
File added
widget_jupert/assignments/migrations/0003_assignment_image.py
0 → 100644
View file @
793f6929
# Generated by Django 3.2.12 on 2022-05-26 11:57
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'assignments'
,
'0002_auto_20220408_0659'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'assignment'
,
name
=
'image'
,
field
=
models
.
FileField
(
blank
=
True
,
null
=
True
,
upload_to
=
'static/assignments/'
),
),
]
widget_jupert/assignments/migrations/__pycache__/0003_assignment_image.cpython-39.pyc
0 → 100644
View file @
793f6929
File added
widget_jupert/assignments/models.py
View file @
793f6929
...
@@ -5,8 +5,8 @@ class Assignment(models.Model):
...
@@ -5,8 +5,8 @@ class Assignment(models.Model):
name
=
models
.
CharField
(
max_length
=
50
)
name
=
models
.
CharField
(
max_length
=
50
)
description
=
models
.
CharField
(
max_length
=
500
)
description
=
models
.
CharField
(
max_length
=
500
)
max_points
=
models
.
IntegerField
(
default
=
0
)
max_points
=
models
.
IntegerField
(
default
=
0
)
passing_score
=
models
.
IntegerField
(
default
=
0
)
passing_score
=
models
.
IntegerField
(
default
=
0
)
image
=
models
.
FileField
(
upload_to
=
'static/assignments/'
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
...
...
widget_jupert/assignments/static/assignments/Jose-Rizal120161230.jpg
0 → 100644
View file @
793f6929
120 KB
widget_jupert/assignments/static/assignments/algebra-review.jpg
0 → 100644
View file @
793f6929
347 KB
widget_jupert/assignments/static/assignments/style.css
0 → 100644
View file @
793f6929
*
{
font-family
:
Courier
New
;
}
h1
{
color
:
#73436D
;
font-weight
:
bold
;
}
h3
{
color
:
#B67C9A
}
img
{
float
:
left
;
width
:
500px
;
height
:
500px
;
object-fit
:
cover
;
border-radius
:
10px
;
}
p
{
color
:
#2a384d
;
}
body
{
background-color
:
#E5E6E9
;
padding
:
1%
0
0
2%
;
}
a
{
color
:
black
;
text-decoration
:
none
;
}
a
:visited
{
color
:
hotpink
;
}
a
:hover
{
color
:
#73436D
;
}
\ No newline at end of file
widget_jupert/assignments/static/assignments/whatisacomputer_desktop_computers.jpg
0 → 100644
View file @
793f6929
52.8 KB
widget_jupert/assignments/templates/assignments/base.html
0 → 100644
View file @
793f6929
{% 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.0"
>
<link
rel=
"stylesheet"
type=
"text/css"
href =
{%
static
'
assignments
/
style
.
css
'
%}
>
<title>
Project Jupert
</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
\ No newline at end of file
widget_jupert/assignments/templates/assignments/details.html
0 → 100644
View file @
793f6929
{% extends "assignments/base.html" %}
{% block content %}
{% for course in course_list2 %}
{% if course.assignment.name == assignments.name %}
<p>
{{ course.course_code }} {{ course.course_title }} {{ course.section }}
</p>
<p>
Assignment name: {{ assignments.name }}
</p>
<p>
Description: {{ assignments.description }}
</p>
<p>
Perfect score: {{ assignments.max_points }}
</p>
<p>
Passing score: {{ assignments.passing_score }}
</p>
{% endif %}
{% endfor %}
<img
src =
{{assignments.image.url}}
>
{% endblock %}
\ No newline at end of file
widget_jupert/assignments/templates/assignments/index.html
0 → 100644
View file @
793f6929
{% extends "assignments/base.html" %}
{% block content %}
<h1>
Assignments Per Course
</h1>
<h3>
List of courses:
</h3>
{% if assignment_list %}
<ul>
{% for course in course_list1 %}
<li>
<b>
{{ course.course_code }} {{ course.course_title }} {{ course.section }}
</b>
</li>
<ul>
{% for assignment in assignment_list %}
{% if course.assignment.name == assignment.name %}
<li><a
href =
"{% url 'assignments:details' assignment.id %}"
>
{{ assignment.name }}
</a></li>
{% endif %}
{% endfor %}
</ul>
{% endfor %}
{% else %}
<p>
No assignments are available.
</p>
{% endif %}
{% endblock %}
\ No newline at end of file
widget_jupert/assignments/urls.py
View file @
793f6929
from
django.urls
import
path
from
django.urls
import
path
from
django.conf.urls.static
import
static
from
django.conf
import
settings
from
.
import
views
from
.
import
views
app_name
=
"assignments"
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
'index'
)
path
(
''
,
views
.
index
,
name
=
'index'
),
]
\ No newline at end of file
#assignments/1/details/
path
(
"<int:assignment_id>/details/"
,
views
.
details
,
name
=
"details"
),
]
+
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
widget_jupert/assignments/views.py
View file @
793f6929
from
django.http
import
HttpResponse
from
urllib
import
response
from
django.http
import
HttpResponse
,
Http404
from
django.shortcuts
import
render
from
assignments.models
import
Assignment
from
assignments.models
import
Assignment
from
assignments.models
import
Course
from
assignments.models
import
Course
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
assignment_objects
=
Assignment
.
objects
.
all
()
assignment_list
=
Assignment
.
objects
.
order_by
(
"name"
)
course_list1
=
Course
.
objects
.
order_by
(
"course_code"
)
context
=
{
"assignment_list"
:
assignment_list
,
"course_list1"
:
course_list1
}
return
render
(
request
,
"assignments/index.html"
,
context
)
def
details
(
request
,
assignment_id
):
course_list2
=
Course
.
objects
.
order_by
(
"course_code"
)
#error handling
try
:
assignments
=
Assignment
.
objects
.
get
(
pk
=
assignment_id
)
except
Assignment
.
DoesNotExist
:
raise
Http404
(
"Assignment does not exist."
)
return
render
(
request
,
"assignments/details.html"
,
{
"assignments"
:
assignments
,
'course_list2'
:
course_list2
})
"""assignment_objects = Assignment.objects.all()
course_objects = Course.objects.all()
course_objects = Course.objects.all()
response = "ASSIGNMENTS:<br>"
response = "ASSIGNMENTS:<br>"
...
@@ -21,4 +46,4 @@ def index(request):
...
@@ -21,4 +46,4 @@ def index(request):
response = (response + "Course/Section: " +
response = (response + "Course/Section: " +
f"{course.course_code} {course.course_title} {course.section} <br>")
f"{course.course_code} {course.course_title} {course.section} <br>")
return
HttpResponse
(
response
)
return HttpResponse(response)"""
\ No newline at end of file
\ 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