From 04335be3aa88ae8c8c448df20012ea1cc10b737c Mon Sep 17 00:00:00 2001 From: eric Date: Thu, 2 Aug 2012 20:44:08 -0400 Subject: [PATCH] add a title filtering parameter to relookup_isbns --- core/management/commands/relookup_isbns.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/management/commands/relookup_isbns.py b/core/management/commands/relookup_isbns.py index 364fe112..bc1db56c 100644 --- a/core/management/commands/relookup_isbns.py +++ b/core/management/commands/relookup_isbns.py @@ -8,12 +8,13 @@ from regluit.core import models, bookloader class Command(BaseCommand): help = "relookup all editions attached to language=xx works" + args = "" - def handle(self, **options): - print "Number of Works with language=xx: %s" % models.Work.objects.filter(language='xx').count() + def handle(self, title='', **options): + print "Number of Works with language=xx, title like %s: %s" % (title, models.Work.objects.filter(language='xx', title__istartswith=title).count()) updated_num=0 - for work in models.Work.objects.filter(language='xx'): + for work in models.Work.objects.filter(language='xx', title__istartswith=title): print "updating work %s" % work for edition in work.editions.all(): print "updating edition %s" % edition