diff --git a/booking/templates/booking/duck_list.html b/booking/templates/booking/duck_list.html
new file mode 100644
index 0000000..03b0d5a
--- /dev/null
+++ b/booking/templates/booking/duck_list.html
@@ -0,0 +1,23 @@
+{% extends 'front_template.html' %}
+{% load booking_tags %}
+
+{% block body %}
+{% if duck_list %}
+{% for duck in duck_list %}
+
+ {{ duck }}
+ {{ duck.species }}
+
+
+ Employee for {{ duck.age|age_format:1 }}
+ Location: {{ duck.location }}
+ DPX: {{ duck.dpx }}
+
book-button
+
complist-button
+
namesugg-button
+
adopt-button
+
+{% endfor %}
+
+{% endif %}
+{% endblock %}
diff --git a/booking/templates/front_template.html b/booking/templates/front_template.html
index f80a890..e3ab9f8 100644
--- a/booking/templates/front_template.html
+++ b/booking/templates/front_template.html
@@ -5,7 +5,7 @@
Rubber Duck Booking Tool
- Home
+ Home
Terms and Conditions
Vocabulary
Disclaimer
diff --git a/booking/tests.py b/booking/tests.py
index 828a226..cdbaab2 100644
--- a/booking/tests.py
+++ b/booking/tests.py
@@ -192,3 +192,25 @@ class BookingTimeTest(TestCase):
def test_dpx(self):
self.assertEqual(self.duck1.dpx(), 1/3)
self.assertEqual(self.duck2.dpx(), 2/3)
+
+class TestListing(TestCase):
+ def setUp(self):
+ self.client = Client()
+
+ species = Species()
+ species.save()
+
+ loc = Location()
+ loc.save()
+
+ user = User()
+ user.save()
+
+ self.duck = Duck(species = species, location = loc, donated_by = user)
+ self.duck.save()
+
+ def test_front_page(self):
+ response = self.client.get('/')
+ self.assertEqual(response.status_code, 200)
+
+ self.assertEqual(len(response.context['duck_list']), 1)
diff --git a/booking/urls.py b/booking/urls.py
index 9c40156..93528cc 100644
--- a/booking/urls.py
+++ b/booking/urls.py
@@ -1,8 +1,11 @@
from django.conf.urls import patterns, url
from django.views.generic.base import TemplateView
+from .views import DuckListView
+
urlpatterns = patterns(
'',
+ url(r'^$', DuckListView.as_view(), name = 'list'),
url(
r'^vocabulary.html$',
TemplateView.as_view(template_name = 'booking/vocabulary.html'),
diff --git a/booking/views.py b/booking/views.py
new file mode 100644
index 0000000..ddb77c9
--- /dev/null
+++ b/booking/views.py
@@ -0,0 +1,11 @@
+from django.shortcuts import render
+from django.views import generic
+
+from .models import Duck
+
+class DuckListView(generic.ListView):
+ template_name = 'booking/duck_list.html'
+ context_object_name = 'duck_list'
+
+ def get_queryset(self):
+ return Duck.objects.all()
diff --git a/duckbook/tests.py b/duckbook/tests.py
deleted file mode 100644
index def16f1..0000000
--- a/duckbook/tests.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from django.test import TestCase, Client
-
-class TestFront(TestCase):
- def setUp(self):
- self.client = Client()
-
- def test_front_page(self):
- response = self.client.get('/')
- self.assertEqual(response.status_code, 200)
-
diff --git a/duckbook/urls.py b/duckbook/urls.py
index f933d21..1a4007c 100644
--- a/duckbook/urls.py
+++ b/duckbook/urls.py
@@ -3,6 +3,5 @@ from django.views.generic import TemplateView
urlpatterns = patterns(
'',
- url('^$', TemplateView.as_view(template_name = 'front_template.html'), name = 'index'),
url('', include('booking.urls', namespace = 'booking')),
)