2011-09-07 09:34:03 +00:00
|
|
|
from django.core.management.base import BaseCommand
|
|
|
|
|
2011-09-10 11:36:38 +00:00
|
|
|
from regluit.core import bookloader
|
2011-09-07 09:34:03 +00:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
help = "load books based on a text file of ISBNs"
|
|
|
|
args = "<filename>"
|
|
|
|
|
|
|
|
def handle(self, filename, **options):
|
|
|
|
for isbn in open(filename):
|
|
|
|
isbn = isbn.strip()
|
2011-10-10 21:26:38 +00:00
|
|
|
edition = bookloader.add_by_isbn(isbn)
|
2011-09-09 18:27:29 +00:00
|
|
|
if edition:
|
2011-10-10 21:26:38 +00:00
|
|
|
print "loaded %s as %s" % (isbn, edition)
|
2011-09-09 18:27:29 +00:00
|
|
|
else:
|
|
|
|
print "failed to load book for %s" % isbn
|