

def handle(self, *args, **options):
    if ((not args) or (len(args) != 2)):
        raise CommandError('Do: scaffold <app_label.model_name> <count>')
    (app_label, separator, model_name) = args[0].partition('.')
    model = loading.get_model(app_label, model_name)
    if (not isinstance(model, models.base.ModelBase)):
        raise CommandError(('%s.%s is not a Django model.' % (app_label, model)))
    count = int(args[1])
    self.stdout.write(('Creating %s\n' % model))
    (factory, finalizer) = self.make_factory(model, count)
    for i in range(count):
        self.make_object(model, factory, finalizer)
    self.stdout.write(('\nCreated %s %ss\n' % (count, model._meta.model_name)))

dataset/ETHPy150Open sbaechler/django-scaffolding/scaffolding/management/commands/scaffold.py Command.handle/original