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
2b168da7
Commit
2b168da7
authored
Apr 07, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added function to display list of items in today template
parent
94437e7f
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
4 deletions
+38
-4
urls.cpython-38.pyc
pages/__pycache__/urls.cpython-38.pyc
+0
-0
views.cpython-38.pyc
pages/__pycache__/views.cpython-38.pyc
+0
-0
urls.py
pages/urls.py
+1
-0
views.py
pages/views.py
+15
-3
add_itemT.html
templates/add_itemT.html
+16
-0
today.html
templates/today.html
+6
-1
No files found.
pages/__pycache__/urls.cpython-38.pyc
View file @
2b168da7
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
2b168da7
No preview for this file type
pages/urls.py
View file @
2b168da7
...
...
@@ -12,4 +12,5 @@ urlpatterns = [
path
(
'edit_itemTW/<int:pk>'
,
views
.
ShowEditItemTW
,
name
=
'edit_itemTW'
),
path
(
'delete_itemTW/<int:pk>'
,
views
.
ShowDeleteItemTW
,
name
=
'delete_itemTW'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
path
(
'add_itemT'
,
views
.
ShowAddItemT
,
name
=
'add_itemT'
),
]
pages/views.py
View file @
2b168da7
import
datetime
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
.forms
import
HomeForm
,
KeyForm
,
ItemsThisWeekForm
from
.models
import
Key
,
ItemsThisWeek
from
.forms
import
HomeForm
,
KeyForm
,
ItemsThisWeekForm
,
ItemsTodayForm
from
.models
import
Key
,
ItemsThisWeek
,
ItemsToday
def
ShowHome
(
request
):
...
...
@@ -77,4 +77,16 @@ def ShowDeleteItemTW(request, pk):
def
ShowToday
(
request
):
return
render
(
request
,
'today.html'
)
item_list
=
ItemsToday
.
objects
.
all
()
return
render
(
request
,
'today.html'
,
{
'item_list'
:
item_list
})
def
ShowAddItemT
(
request
):
form
=
ItemsTodayForm
()
if
request
.
method
==
'POST'
:
form
=
ItemsTodayForm
(
request
.
POST
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'today'
)
return
render
(
request
,
'add_itemT.html'
,
{
'form'
:
form
})
templates/add_itemT.html
0 → 100644
View file @
2b168da7
{% extends 'base.html' %}
{% load static %}
{% block title %} Key {% endblock %}
{% block header %} Key {% endblock %}
{% block content %}
<form
action=
''
method=
'POST'
>
{% csrf_token %}
{{ form }}
<input
type=
'submit'
name=
'Submit'
value=
'Add'
>
</form>
{% endblock %}
templates/today.html
View file @
2b168da7
...
...
@@ -10,7 +10,12 @@
<div
id=
'today'
>
<h2>
04.14.WED
</h2>
<br>
<button
type=
'button'
>
Add Item
</button>
{% for item in item_list %}
<p>
<b>
{{ item.key_type }}:
</b>
{{ item.details }}
<p>
{% endfor %}
<a
href=
'{% url '
add_itemT
'
%}'
><button
type=
'button'
>
Add Item
</button></a>
</div>
{% endblock %}
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