Forgot to add a few new files to previous commit.

pull/1/head
Raymond Yee 2011-09-14 08:40:42 -07:00
parent 14ae7090e6
commit 1de0717c8c
2 changed files with 67 additions and 0 deletions

56
api/templates/isbn.html Normal file
View File

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<head>
<title>isbn</title>
</head>
<body>
<p>You entered isbn: {{isbn}}</p>
<!--- editions --->
{% if editions %}
<ul>
{% for edition in editions %}
<li>{{edition.id}} | {{edition.title}}
<!-- editioncovers for given edition -->
{% if edition.covers.all %}
<ul id="id">
{% for editioncover in edition.covers.all %}
<li>cover OL id: {{editioncover.openlibrary_id}}</li>
{% endfor %}
</ul>
{% else %}
<p class="classname">No editioncover for this edition</p>
{% endif %}
<!-- related work -->
{% if edition.work %}
<p class="classname">Related work: {{edition.work.id}} | {{edition.work.title}} <br/>
{{edition.work.authors.all}} </p>
{% endif %}
<!-- related campaigns -->
{% if edition.work.campaigns.all %}
<ul id="id">
{% for campaign in edition.work.campaigns.all %}
<li>Campaign: {{campaign.id}} | {{campaign.name}} | {{campaign.description}} <br/>
{{campaign.target}} {{campaign.deadline}}</li>
{% endfor %}
</ul>
{% else %}
<p class="classname">No associated campaigns</p>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>No editions are available.</p>
{% endif %}
</body>
</html>

View File

@ -0,0 +1,11 @@
from django.core.management.base import BaseCommand
from regluit.core import models
class Command(BaseCommand):
help = "list all editions in the database"
def handle(self, *args, **options):
editions = models.Edition.objects.all()
for edition in editions:
print edition.id, edition.title