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
61f8a525
Commit
61f8a525
authored
Apr 08, 2021
by
James Esguerra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added "Mark as done" button to this week view
parent
9fcf6e04
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
77 additions
and
5 deletions
+77
-5
forms.cpython-38.pyc
pages/__pycache__/forms.cpython-38.pyc
+0
-0
models.cpython-38.pyc
pages/__pycache__/models.cpython-38.pyc
+0
-0
views.cpython-38.pyc
pages/__pycache__/views.cpython-38.pyc
+0
-0
forms.py
pages/forms.py
+2
-0
0011_auto_20210407_2046.py
pages/migrations/0011_auto_20210407_2046.py
+33
-0
0012_auto_20210407_2057.py
pages/migrations/0012_auto_20210407_2057.py
+21
-0
0011_auto_20210407_2046.cpython-38.pyc
...ations/__pycache__/0011_auto_20210407_2046.cpython-38.pyc
+0
-0
0012_auto_20210407_2057.cpython-38.pyc
...ations/__pycache__/0012_auto_20210407_2057.cpython-38.pyc
+0
-0
views.py
pages/views.py
+12
-3
this_week.html
templates/this_week.html
+6
-2
today.html
templates/today.html
+3
-0
No files found.
pages/__pycache__/forms.cpython-38.pyc
View file @
61f8a525
No preview for this file type
pages/__pycache__/models.cpython-38.pyc
View file @
61f8a525
No preview for this file type
pages/__pycache__/views.cpython-38.pyc
View file @
61f8a525
No preview for this file type
pages/forms.py
View file @
61f8a525
...
...
@@ -34,9 +34,11 @@ class ItemsThisWeekForm(forms.ModelForm):
class
Meta
:
model
=
ItemsThisWeek
fields
=
'__all__'
exclude
=
(
'is_task'
,)
class
ItemsTodayForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
ItemsToday
fields
=
'__all__'
exclude
=
(
'is_task'
,)
pages/migrations/0011_auto_20210407_2046.py
0 → 100644
View file @
61f8a525
# Generated by Django 3.1.7 on 2021-04-07 12:46
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'pages'
,
'0010_auto_20210407_1702'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'itemsthisweek'
,
name
=
'is_task'
,
field
=
models
.
BooleanField
(
default
=
False
),
),
migrations
.
AddField
(
model_name
=
'itemstoday'
,
name
=
'is_task'
,
field
=
models
.
BooleanField
(
default
=
False
),
),
migrations
.
AlterField
(
model_name
=
'user'
,
name
=
'bio'
,
field
=
models
.
TextField
(
max_length
=
100
),
),
migrations
.
AlterField
(
model_name
=
'user'
,
name
=
'nickname'
,
field
=
models
.
CharField
(
max_length
=
50
),
),
]
pages/migrations/0012_auto_20210407_2057.py
0 → 100644
View file @
61f8a525
# Generated by Django 3.1.7 on 2021-04-07 12:57
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'pages'
,
'0011_auto_20210407_2046'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'itemsthisweek'
,
name
=
'is_task'
,
),
migrations
.
RemoveField
(
model_name
=
'itemstoday'
,
name
=
'is_task'
,
),
]
pages/migrations/__pycache__/0011_auto_20210407_2046.cpython-38.pyc
0 → 100644
View file @
61f8a525
File added
pages/migrations/__pycache__/0012_auto_20210407_2057.cpython-38.pyc
0 → 100644
View file @
61f8a525
File added
pages/views.py
View file @
61f8a525
import
datetime
from
django.shortcuts
import
render
,
redirect
from
django.http
import
HttpResponse
from
.forms
import
(
...
...
@@ -94,7 +93,17 @@ def ShowAddKey(request):
def
ShowThisWeek
(
request
):
item_list
=
ItemsThisWeek
.
objects
.
all
()
item_list
=
list
(
ItemsThisWeek
.
objects
.
all
())
if
request
.
method
==
'POST'
:
for
i
in
request
.
POST
.
keys
():
name
=
i
for
item
in
item_list
:
if
str
(
item
.
id
)
==
name
:
item
.
key_type
.
key_name
=
'Task done'
break
return
render
(
request
,
'this_week.html'
,
{
'item_list'
:
item_list
})
...
...
@@ -132,7 +141,7 @@ def ShowDeleteItemTW(request, pk):
def
ShowToday
(
request
):
item_list
=
ItemsToday
.
objects
.
all
(
)
item_list
=
list
(
ItemsToday
.
objects
.
all
()
)
return
render
(
request
,
'today.html'
,
{
'item_list'
:
item_list
})
...
...
templates/this_week.html
View file @
61f8a525
...
...
@@ -11,11 +11,15 @@
<h2>
04.12.MON - 04.18.SUN
</h2>
<br>
{% for item in item_list %}
<
p
>
<
form
method=
'POST'
>
<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'
>
Delete
</button></a>
</p>
{% if item.key_type.key_name == 'Task' %}
{% csrf_token %}
<input
type=
'submit'
name=
'{{ item.id }}'
value=
'Mark as done'
/>
{% endif %}
</form>
{% endfor %}
<a
href=
'{% url '
add_itemTW
'
%}'
><button
type=
'button'
>
Add Item
</button></a>
</div>
...
...
templates/today.html
View file @
61f8a525
...
...
@@ -15,6 +15,9 @@
<b>
{{ item.key_type }}:
</b>
{{ item.details }}
<a
href=
'{% url '
edit_itemT
'
item
.
pk
%}'
><button
type=
'button'
>
Edit
</button></a>
<a
href=
'{% url '
delete_itemT
'
item
.
pk
%}'
><button
type=
'button'
>
Delete
</button></a>
{% if item.key_type.key_name == 'Task' %}
<input
type=
'submit'
name=
'Submit'
method=
'POST'
value=
'Mark as done'
>
{% endif %}
<p>
{% endfor %}
<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