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
7cc208d9
Commit
7cc208d9
authored
Apr 07, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added edit button to list of items today to redirect to edit view
parent
2b168da7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
0 deletions
+31
-0
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
+13
-0
edit_itemT.html
templates/edit_itemT.html
+16
-0
today.html
templates/today.html
+1
-0
No files found.
pages/__pycache__/urls.cpython-38.pyc
View file @
7cc208d9
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
7cc208d9
No preview for this file type
pages/urls.py
View file @
7cc208d9
...
@@ -13,4 +13,5 @@ urlpatterns = [
...
@@ -13,4 +13,5 @@ urlpatterns = [
path
(
'delete_itemTW/<int:pk>'
,
views
.
ShowDeleteItemTW
,
name
=
'delete_itemTW'
),
path
(
'delete_itemTW/<int:pk>'
,
views
.
ShowDeleteItemTW
,
name
=
'delete_itemTW'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
path
(
'add_itemT'
,
views
.
ShowAddItemT
,
name
=
'add_itemT'
),
path
(
'add_itemT'
,
views
.
ShowAddItemT
,
name
=
'add_itemT'
),
path
(
'edit_itemT/<int:pk>'
,
views
.
ShowEditItemT
,
name
=
'edit_itemT'
),
]
]
pages/views.py
View file @
7cc208d9
...
@@ -90,3 +90,16 @@ def ShowAddItemT(request):
...
@@ -90,3 +90,16 @@ def ShowAddItemT(request):
return
redirect
(
'today'
)
return
redirect
(
'today'
)
return
render
(
request
,
'add_itemT.html'
,
{
'form'
:
form
})
return
render
(
request
,
'add_itemT.html'
,
{
'form'
:
form
})
def
ShowEditItemT
(
request
,
pk
):
item
=
ItemsToday
.
objects
.
get
(
id
=
pk
)
form
=
ItemsTodayForm
(
instance
=
item
)
if
request
.
method
==
'POST'
:
form
=
ItemsTodayForm
(
request
.
POST
,
instance
=
item
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'today'
)
return
render
(
request
,
'edit_itemT.html'
,
{
'form'
:
form
})
templates/edit_itemT.html
0 → 100644
View file @
7cc208d9
{% 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=
'Save'
>
</form>
{% endblock %}
templates/today.html
View file @
7cc208d9
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
{% for item in item_list %}
{% for item in item_list %}
<p>
<p>
<b>
{{ item.key_type }}:
</b>
{{ item.details }}
<b>
{{ item.key_type }}:
</b>
{{ item.details }}
<a
href=
'{% url '
edit_itemT
'
item
.
pk
%}'
><button
type=
'button'
>
Edit
</button></a>
<p>
<p>
{% endfor %}
{% endfor %}
<a
href=
'{% url '
add_itemT
'
%}'
><button
type=
'button'
>
Add Item
</button></a>
<a
href=
'{% url '
add_itemT
'
%}'
><button
type=
'button'
>
Add Item
</button></a>
...
...
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