Added /api/editions to make it easier to test /api/isbn
parent
4892a779d1
commit
93eb9a1549
|
@ -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>
|
||||
|
||||
|
|
@ -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)),
|
||||
)
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue