class MyCommand(BaseCommand):

    def handle(self, *args, **options):
        if len(args) > 0:
            raise CommandError('need exactly zero arguments')
for i in range(1000):
    MyModel(number=i).save()
Django - Populating a database for test purposes