-class Command(NoArgsCommand):
- def handle_noargs(self, **options):
- for image in Image.objects.exclude(book=None).order_by('id'):
+class Command(BaseCommand):
+ option_list = BaseCommand.option_list + (
+ make_option('--from', dest='from_id', type=int, default=1),
+ )
+
+ def handle(self, *args, **options):
+ from_id = options.get('from_id', 1)
+ images = Image.objects.filter(id__gte=from_id).exclude(book=None).order_by('id')
+ images = images.filter(source_url__contains='flickr.com').exclude(download_url__endswith='_o.jpg')
+ for image in images: