diff --git a/imagekit/management/commands/generateimages.py b/imagekit/management/commands/generateimages.py index 0d9cae5..2addfd3 100644 --- a/imagekit/management/commands/generateimages.py +++ b/imagekit/management/commands/generateimages.py @@ -14,11 +14,15 @@ match both. Subsegments are always matched, so "a" will match "a" as well as "a:b" and "a:b:c".""") args = '[generator_ids]' + def add_arguments(self, parser): + parser.add_argument('generator_id', nargs='*', help=':: for model specs') + def handle(self, *args, **options): generators = generator_registry.get_ids() - if args: - patterns = self.compile_patterns(args) + generator_ids = options['generator_id'] if 'generator_id' in options else args + if generator_ids: + patterns = self.compile_patterns(generator_ids) generators = (id for id in generators if any(p.match(id) for p in patterns)) for generator_id in generators: