Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
esguerra_lab1
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
James Esguerra
esguerra_lab1
Commits
c8042de8
Commit
c8042de8
authored
Apr 06, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added function to display list of items in this_week template
parent
9cd72bfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
views.cpython-38.pyc
pages/__pycache__/views.cpython-38.pyc
+0
-0
views.py
pages/views.py
+4
-7
this_week.html
templates/this_week.html
+4
-0
No files found.
pages/__pycache__/views.cpython-38.pyc
View file @
c8042de8
No preview for this file type
pages/views.py
View file @
c8042de8
...
@@ -2,7 +2,7 @@ import datetime
...
@@ -2,7 +2,7 @@ import datetime
from
django.shortcuts
import
render
,
redirect
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
.forms
import
HomeForm
,
KeyForm
,
ItemsThisWeekForm
from
.forms
import
HomeForm
,
KeyForm
,
ItemsThisWeekForm
from
.models
import
Key
from
.models
import
Key
,
ItemsThisWeek
def
ShowHome
(
request
):
def
ShowHome
(
request
):
...
@@ -24,10 +24,7 @@ def ShowProfile(request):
...
@@ -24,10 +24,7 @@ def ShowProfile(request):
def
ShowKey
(
request
):
def
ShowKey
(
request
):
key_list
=
Key
.
objects
.
all
()
key_list
=
Key
.
objects
.
all
()
context
=
{
return
render
(
request
,
'key.html'
,
{
'key_list'
:
key_list
})
'key_list'
:
key_list
,
}
return
render
(
request
,
'key.html'
,
context
)
def
ShowAddKey
(
request
):
def
ShowAddKey
(
request
):
...
@@ -42,7 +39,8 @@ def ShowAddKey(request):
...
@@ -42,7 +39,8 @@ def ShowAddKey(request):
def
ShowThisWeek
(
request
):
def
ShowThisWeek
(
request
):
return
render
(
request
,
'this_week.html'
)
item_list
=
ItemsThisWeek
.
objects
.
all
()
return
render
(
request
,
'this_week.html'
,
{
'item_list'
:
item_list
})
def
ShowAddItemTW
(
request
):
def
ShowAddItemTW
(
request
):
...
@@ -56,7 +54,6 @@ def ShowAddItemTW(request):
...
@@ -56,7 +54,6 @@ def ShowAddItemTW(request):
return
render
(
request
,
'add_itemTW.html'
,
{
'form'
:
form
})
return
render
(
request
,
'add_itemTW.html'
,
{
'form'
:
form
})
def
ShowToday
(
request
):
def
ShowToday
(
request
):
my_date
=
datetime
.
datetime
.
now
()
my_date
=
datetime
.
datetime
.
now
()
return
render
(
request
,
'today.html'
,
{
'my_date'
:
my_date
})
return
render
(
request
,
'today.html'
,
{
'my_date'
:
my_date
})
templates/this_week.html
View file @
c8042de8
...
@@ -10,6 +10,10 @@
...
@@ -10,6 +10,10 @@
<div
id=
'this_week'
>
<div
id=
'this_week'
>
<h2>
04.12.MON - 04.18.SUN
</h2>
<h2>
04.12.MON - 04.18.SUN
</h2>
{% for item in item_list %}
<p><b>
{{ item.key_type }}:
</b>
{{ item.details }}
</p>
{% endfor %}
<a
href=
'{% url '
add_itemTW
'
%}'
><button
type=
'button'
>
Add Item
</button></a>
<a
href=
'{% url '
add_itemTW
'
%}'
><button
type=
'button'
>
Add Item
</button></a>
</div>
</div>
...
...
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