From 93eb9a1549ff695e89ccf5f7ef6a3665edeffb11 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Wed, 14 Sep 2011 10:31:16 -0700 Subject: [PATCH] Added /api/editions to make it easier to test /api/isbn --- api/templates/editions.html | 26 ++++++++++++++++++++++++++ api/urls.py | 3 ++- api/views.py | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 api/templates/editions.html diff --git a/api/templates/editions.html b/api/templates/editions.html new file mode 100644 index 00000000..d0d569d9 --- /dev/null +++ b/api/templates/editions.html @@ -0,0 +1,26 @@ + + + + editions + + + + + + + {% if editions %} + + {% else %} +

No editions are available.

+ {% endif %} + + + + + diff --git a/api/urls.py b/api/urls.py index 84fdb8a9..b7032e42 100644 --- a/api/urls.py +++ b/api/urls.py @@ -14,6 +14,7 @@ v1_api.register(SubjectResource()) v1_api.register(WishlistResource()) urlpatterns = patterns('', - (r'^isbn/(?P\w+)/$','regluit.api.views.isbn'), + url(r'^editions/$', 'regluit.api.views.editions', name="editions"), + url(r'^isbn/(?P\w+)/$','regluit.api.views.isbn', name="isbn"), (r'^', include(v1_api.urls)), ) diff --git a/api/views.py b/api/views.py index bdb09699..73edd613 100755 --- a/api/views.py +++ b/api/views.py @@ -14,3 +14,9 @@ def isbn(request,isbn): context_instance=RequestContext(request) ) +def editions(request): + editions = models.Edition.objects.all() + return render_to_response('editions.html', + {'editions':editions}, + context_instance=RequestContext(request) + )