Added /api/editions to make it easier to test /api/isbn

pull/1/head
Raymond Yee 2011-09-14 10:31:16 -07:00
parent 4892a779d1
commit 93eb9a1549
3 changed files with 34 additions and 1 deletions

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>editions</title>
</head>
<body>
<!--- editions --->
{% if editions %}
<ul>
{% for edition in editions %}
<li> <img src="http://covers.openlibrary.org/b/isbn/{{edition.isbn_10}}-S.jpg" /> {{edition.id}} | {{edition.title}} |
<a href="{% url isbn isbn=edition.isbn_10 %}">{{edition.isbn_10}}</a> |
<a href="{% url isbn isbn=edition.isbn_13 %}">{{edition.isbn_13}}</a>
{% endfor %}
</ul>
{% else %}
<p>No editions are available.</p>
{% endif %}
</body>
</html>

View File

@ -14,6 +14,7 @@ v1_api.register(SubjectResource())
v1_api.register(WishlistResource())
urlpatterns = patterns('',
(r'^isbn/(?P<isbn>\w+)/$','regluit.api.views.isbn'),
url(r'^editions/$', 'regluit.api.views.editions', name="editions"),
url(r'^isbn/(?P<isbn>\w+)/$','regluit.api.views.isbn', name="isbn"),
(r'^', include(v1_api.urls)),
)

View File

@ -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)
)