regluit/core/management/commands/goodreads_load_books.py

19 lines
759 B
Python
Raw Normal View History

from django.core.management.base import BaseCommand
from regluit.core.goodreads import GoodreadsClient
from regluit.core import tasks, bookloader
from django.conf import settings
from django.contrib.auth.models import User
#from regluit.core.goodreads import load_shelf_into_wishlist
from regluit.core import tasks
class Command(BaseCommand):
help = "list books on given user bookshelf"
args = "<user_name goodreads_user_id shelf_name max_books>"
def handle(self, user_name, goodreads_user_id, shelf_name, max_books, **options):
user = User.objects.get(username=user_name)
max_books = int(max_books)
2012-02-16 18:19:36 +00:00
tasks.load_goodreads_shelf_into_wishlist.delay(user.id, shelf_name, goodreads_user_id, max_books)