Ejemplo n.º 1
0
 def handle(self, *args, **options):
     if not all(exists(path) for path in self.required_dirs):
         msg = 'Directories %s with images are required.' % ', '.join(
             self.required_dirs)
         raise CommandError(msg)
     for msg in create_items(self.BASE_DIR, 10):
         self.stdout.write(msg)
Ejemplo n.º 2
0
    def handle(self, *args, **options):
        self.make_database_faster()
        for msg in create_items(self.placeholders_dir, 40):
            self.stdout.write(msg)
        for msg in create_users(20):
            self.stdout.write(msg)
        for msg in create_orders(20):
            self.stdout.write(msg)

        if options['createsuperuser']:
            credentials = {'email': '*****@*****.**', 'password': '******'}
            user, created = User.objects.get_or_create(
                email=credentials['email'],
                defaults={
                    'is_active': True,
                    'is_staff': True,
                    'is_superuser': True
                })
            if created:
                user.set_password(credentials['password'])
                user.save()
                self.stdout.write('Superuser - %(email)s/%(password)s' %
                                  credentials)
            else:
                self.stdout.write('Superuser already exists - %(email)s' %
                                  credentials)
Ejemplo n.º 3
0
 def handle(self, *args, **options):
     if not all(exists(path) for path in self.required_dirs):
         msg = 'Directories %s with images are required.' % ', '.join(
             self.required_dirs)
         raise CommandError(msg)
     for msg in create_items(self.BASE_DIR, 10):
         self.stdout.write(msg)
Ejemplo n.º 4
0
 def handle(self, *args, **options):
     if not exists(self.placeholders_dir):
         msg = 'Directory %s with images is required.' % self.placeholders_dir
         raise CommandError(msg)
     for msg in create_items(self.placeholders_dir, 10):
         self.stdout.write(msg)
     for msg in create_users(10):
         self.stdout.write(msg)
Ejemplo n.º 5
0
    def handle(self, *args, **options):
        for msg in create_items(self.placeholders_dir, 10):
            self.stdout.write(msg)
        for msg in create_users(10):
            self.stdout.write(msg)
        for msg in create_orders(20):
            self.stdout.write(msg)

        if options['createsuperuser']:
            user = User.objects.create_superuser(
                email='*****@*****.**', password='******')
            self.stdout.write('Superuser - %s' % user.email)
Ejemplo n.º 6
0
    def handle(self, *args, **options):
        for msg in create_items(self.placeholders_dir, 10):
            self.stdout.write(msg)
        for msg in create_users(10):
            self.stdout.write(msg)
        for msg in create_orders(20):
            self.stdout.write(msg)

        if options['createsuperuser']:
            credentials = {'email': '*****@*****.**', 'password': '******'}
            user, created = User.objects.get_or_create(
                email=credentials['email'], defaults={
                    'is_active': True, 'is_staff': True, 'is_superuser': True})
            if created:
                user.set_password(credentials['password'])
                user.save()
                self.stdout.write(
                    'Superuser - %(email)s/%(password)s' % credentials)
            else:
                self.stdout.write(
                    'Superuser already exists - %(email)s' % credentials)
Ejemplo n.º 7
0
 def run(self):
     from django.core.management import call_command
     from utils.create_random_data import create_items
     call_command('syncdb', interactive=True, migrate_all=True)
     create_items('saleor/static/placeholders/', 10)
Ejemplo n.º 8
0
 def run(self):
     from django.core.management import call_command
     from utils.create_random_data import create_items
     call_command('syncdb', interactive=True, migrate_all=True)
     create_items('saleor/static/placeholders/', 10)