Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
widget_placeholdername
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
Rajo Christian Cadorna
widget_placeholdername
Commits
4e659ebd
Commit
4e659ebd
authored
Apr 04, 2022
by
Rajo Christian Cadorna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added assignments.html template
parent
48ec8443
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
13 deletions
+46
-13
assignment.html
assignments/templates/assignment.html
+16
-0
models.py
homepage/models.py
+1
-5
view.html
homepage/templates/view.html
+17
-0
views.py
homepage/views.py
+12
-8
No files found.
assignments/templates/assignment.html
0 → 100644
View file @
4e659ebd
<!DOCTYPE html>
<html
lang=
"en"
>
<body>
<h1>
Assignments:
</h1>
{% for assignment in assignments %}
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}}
<br><br>
{% endfor %}
</body>
</html>
homepage/models.py
View file @
4e659ebd
...
@@ -9,8 +9,7 @@ class WidgetUser(models.Model):
...
@@ -9,8 +9,7 @@ class WidgetUser(models.Model):
id_num
=
models
.
IntegerField
()
id_num
=
models
.
IntegerField
()
email
=
models
.
EmailField
(
max_length
=
100
)
email
=
models
.
EmailField
(
max_length
=
100
)
def
__str__
(
self
):
return
self
.
last_name
+
", "
+
self
.
first_name
+
" "
+
self
.
middle_name
+
": "
+
str
(
self
.
id_num
)
+
", "
+
self
.
email
+
"<br>"
...
@@ -18,6 +17,3 @@ class Department(models.Model):
...
@@ -18,6 +17,3 @@ class Department(models.Model):
widgetuser
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
widgetuser
=
models
.
ForeignKey
(
WidgetUser
,
on_delete
=
models
.
CASCADE
)
dept_name
=
models
.
CharField
(
max_length
=
50
)
dept_name
=
models
.
CharField
(
max_length
=
50
)
home_unit
=
models
.
CharField
(
max_length
=
50
)
home_unit
=
models
.
CharField
(
max_length
=
50
)
def
__str__
(
self
):
return
self
.
widgetuser
.
last_name
+
", "
+
self
.
widgetuser
.
first_name
+
" "
+
self
.
widgetuser
.
middle_name
+
": "
+
str
(
self
.
widgetuser
.
id_num
)
+
", "
+
self
.
widgetuser
.
email
+
", "
+
self
.
dept_name
+
", "
+
self
.
home_unit
+
"<br>"
\ No newline at end of file
homepage/templates/view.html
0 → 100644
View file @
4e659ebd
<!DOCTYPE html>
<html
lang=
"en"
>
<body>
<h1>
WIDGET USERS:
</h1>
{% for Depts in Depts %}
<h4>
{{Depts.widgetuser.last_name}}, {{Depts.widgetuser.first_name}} {{Depts.widgetuser.middle_name}}: {{Depts.widgetuser.id_num}}, {{Depts.widgetuser.email}}, {{ Depts.dept_name }}, {{ Depts.home_unit }}
</h4>
{% endfor %}
</body>
</html>
\ No newline at end of file
homepage/views.py
View file @
4e659ebd
from
itertools
import
chain
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.models
import
WidgetUser
from
.
models
import
WidgetUser
from
.models
import
Department
from
.
models
import
Department
from
django.shortcuts
import
render
# Create your views here.
# Create your views here.
def
index
(
request
):
def
index
(
request
):
display0
=
"WIDGET USERS: <br>"
widgets
=
WidgetUser
.
objects
.
all
()
display1
=
list
(
display0
)
depts
=
Department
.
objects
.
all
()
display2
=
Department
.
objects
.
all
()
finalDisplay
=
chain
(
display1
,
display2
)
context
=
{
return
HttpResponse
(
finalDisplay
)
'Widgets'
:
widgets
,
'Depts'
:
depts
}
return
render
(
request
,
"view.html"
,
context
)
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