Commit ab53dd6d authored by James Esguerra's avatar James Esguerra

Added function to display list of keys in key template

parent 19e5e4e9
...@@ -2,6 +2,7 @@ import datetime ...@@ -2,6 +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 from .forms import HomeForm, KeyForm
from .models import Key
def ShowHome(request): def ShowHome(request):
...@@ -22,7 +23,11 @@ def ShowProfile(request): ...@@ -22,7 +23,11 @@ def ShowProfile(request):
def ShowKey(request): def ShowKey(request):
return render(request, 'key.html') key_list = Key.objects.all()
context = {
'key_list': key_list,
}
return render(request, 'key.html', context)
def ShowAddKey(request): def ShowAddKey(request):
......
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
{% block content %} {% block content %}
<a href='{% url 'add_key' %}'><button type='button'> Add Key </button></a> <h3>Key &nbsp Description</h3>
{% for key in key_list %}
<p> {{ key.key_name }} {{ key.key_description }} </p>
{% endfor %}
<a href='{% url 'add_key' %}'><button type='button'> Add Key </button></a>
{% endblock %} {% endblock %}
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