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
3a6ec072
Commit
3a6ec072
authored
Apr 07, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added edit button to list of items to redirect to edit view
parent
c8042de8
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
3 deletions
+35
-3
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_itemTW.html
templates/edit_itemTW.html
+16
-0
this_week.html
templates/this_week.html
+5
-3
No files found.
pages/__pycache__/urls.cpython-38.pyc
View file @
3a6ec072
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
3a6ec072
No preview for this file type
pages/urls.py
View file @
3a6ec072
...
@@ -9,5 +9,6 @@ urlpatterns = [
...
@@ -9,5 +9,6 @@ urlpatterns = [
path
(
'add_key/'
,
views
.
ShowAddKey
,
name
=
'add_key'
),
path
(
'add_key/'
,
views
.
ShowAddKey
,
name
=
'add_key'
),
path
(
'this_week/'
,
views
.
ShowThisWeek
,
name
=
'this_week'
),
path
(
'this_week/'
,
views
.
ShowThisWeek
,
name
=
'this_week'
),
path
(
'add_itemTW/'
,
views
.
ShowAddItemTW
,
name
=
'add_itemTW'
),
path
(
'add_itemTW/'
,
views
.
ShowAddItemTW
,
name
=
'add_itemTW'
),
path
(
'edit_itemTW/<int:pk>'
,
views
.
ShowEditItemTW
,
name
=
'edit_itemTW'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
path
(
'today/'
,
views
.
ShowToday
,
name
=
'today'
),
]
]
pages/views.py
View file @
3a6ec072
...
@@ -54,6 +54,19 @@ def ShowAddItemTW(request):
...
@@ -54,6 +54,19 @@ def ShowAddItemTW(request):
return
render
(
request
,
'add_itemTW.html'
,
{
'form'
:
form
})
return
render
(
request
,
'add_itemTW.html'
,
{
'form'
:
form
})
def
ShowEditItemTW
(
request
,
pk
):
item
=
ItemsThisWeek
.
objects
.
get
(
id
=
pk
)
form
=
ItemsThisWeekForm
(
instance
=
item
)
if
request
.
method
==
'POST'
:
form
=
ItemsThisWeekForm
(
request
.
POST
,
instance
=
item
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
'this_week'
)
return
render
(
request
,
'edit_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/edit_itemTW.html
0 → 100644
View file @
3a6ec072
{% 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/this_week.html
View file @
3a6ec072
...
@@ -9,11 +9,13 @@
...
@@ -9,11 +9,13 @@
<div
id=
'this_week'
>
<div
id=
'this_week'
>
<h2>
04.12.MON - 04.18.SUN
</h2>
<h2>
04.12.MON - 04.18.SUN
</h2>
<br>
{% for item in item_list %}
{% for item in item_list %}
<p><b>
{{ item.key_type }}:
</b>
{{ item.details }}
</p>
<p>
<b>
{{ item.key_type }}:
</b>
{{ item.details }}
<a
href=
'{% url '
edit_itemTW
'
item
.
pk
%}'
><button
type=
'button'
>
Edit
</button></a>
</p>
{% endfor %}
{% 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