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
39d0a51f
Commit
39d0a51f
authored
Apr 07, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added delete button to list of items TW to redirect to delete view
parent
3a6ec072
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
0 deletions
+27
-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
+9
-0
delete_itemTW.html
templates/delete_itemTW.html
+16
-0
this_week.html
templates/this_week.html
+1
-0
No files found.
pages/__pycache__/urls.cpython-38.pyc
View file @
39d0a51f
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
39d0a51f
No preview for this file type
pages/urls.py
View file @
39d0a51f
...
...
@@ -10,5 +10,6 @@ urlpatterns = [
path
(
'this_week/'
,
views
.
ShowThisWeek
,
name
=
'this_week'
),
path
(
'add_itemTW/'
,
views
.
ShowAddItemTW
,
name
=
'add_itemTW'
),
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'
),
]
pages/views.py
View file @
39d0a51f
...
...
@@ -67,6 +67,15 @@ def ShowEditItemTW(request, pk):
return
render
(
request
,
'edit_itemTW.html'
,
{
'form'
:
form
})
def
ShowDeleteItemTW
(
request
,
pk
):
if
request
.
method
==
'POST'
:
item
=
ItemsThisWeek
.
objects
.
get
(
id
=
pk
)
item
.
delete
()
return
redirect
(
'this_week'
)
return
render
(
request
,
'delete_itemTW.html'
)
def
ShowToday
(
request
):
my_date
=
datetime
.
datetime
.
now
()
return
render
(
request
,
'today.html'
,
{
'my_date'
:
my_date
})
templates/delete_itemTW.html
0 → 100644
View file @
39d0a51f
{% extends 'base.html' %}
{% load static %}
{% block title %} Key {% endblock %}
{% block header %} Key {% endblock %}
{% block content %}
<form
action=
''
method=
'POST'
>
{% csrf_token %}
<input
type=
'submit'
name=
'Submit'
value=
'Yes'
>
<a
href=
'{% url '
this_week
'
%}'
><button
type=
'button'
>
No
</button></a>
</form>
{% endblock %}
templates/this_week.html
View file @
39d0a51f
...
...
@@ -14,6 +14,7 @@
<p>
<b>
{{ item.key_type }}:
</b>
{{ item.details }}
<a
href=
'{% url '
edit_itemTW
'
item
.
pk
%}'
><button
type=
'button'
>
Edit
</button></a>
<a
href=
'{% url '
delete_itemTW
'
item
.
pk
%}'
><button
type=
'button'
>
X
</button></a>
</p>
{% endfor %}
<a
href=
'{% url '
add_itemTW
'
%}'
><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