Commit c8042de8 authored by James Esguerra's avatar James Esguerra

Added function to display list of items in this_week template

parent 9cd72bfe
...@@ -2,7 +2,7 @@ import datetime ...@@ -2,7 +2,7 @@ import datetime
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.http import HttpResponse from django.http import HttpResponse
from .forms import HomeForm, KeyForm, ItemsThisWeekForm from .forms import HomeForm, KeyForm, ItemsThisWeekForm
from .models import Key from .models import Key, ItemsThisWeek
def ShowHome(request): def ShowHome(request):
...@@ -24,10 +24,7 @@ def ShowProfile(request): ...@@ -24,10 +24,7 @@ def ShowProfile(request):
def ShowKey(request): def ShowKey(request):
key_list = Key.objects.all() key_list = Key.objects.all()
context = { return render(request, 'key.html', {'key_list': key_list})
'key_list': key_list,
}
return render(request, 'key.html', context)
def ShowAddKey(request): def ShowAddKey(request):
...@@ -42,7 +39,8 @@ def ShowAddKey(request): ...@@ -42,7 +39,8 @@ def ShowAddKey(request):
def ShowThisWeek(request): def ShowThisWeek(request):
return render(request, 'this_week.html') item_list = ItemsThisWeek.objects.all()
return render(request, 'this_week.html', {'item_list': item_list})
def ShowAddItemTW(request): def ShowAddItemTW(request):
...@@ -56,7 +54,6 @@ def ShowAddItemTW(request): ...@@ -56,7 +54,6 @@ def ShowAddItemTW(request):
return render(request, 'add_itemTW.html', {'form': form}) return render(request, 'add_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})
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<div id='this_week'> <div id='this_week'>
<h2>04.12.MON - 04.18.SUN</h2> <h2>04.12.MON - 04.18.SUN</h2>
{% for item in item_list %}
<p><b>{{ item.key_type }}:</b> {{ item.details }} </p>
{% 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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment