Repository: saleor/saleor

Issue:
Design example product images
This is for the `populatedb` command that creates a bunch of example products.



Discussion:
testowo narazie - 1 zajawka - punkt zaczepienia do dalszej dyskusji.. fajnie by wymyslec jakis wspolny patent poza nazwa na produkty ... ze np jedzenie czy kolorystyka ... tbc ... 
wrzucam pare opcji zeby zobaczc w ktora strone najlepiej isc z dizajnami ewentualnie czego nie chcemy...  
![tst-a](https://cloud.githubusercontent.com/assets/7837760/8328772/f72bc2f0-1a73-11e5-9bd7-51f3297551b8.png)
![tst-b](https://cloud.githubusercontent.com/assets/7837760/8328774/f72d91fc-1a73-11e5-8a9e-a69d9e47b6d5.png)
![tst-c](https://cloud.githubusercontent.com/assets/7837760/8328775/f72f3ebc-1a73-11e5-84ae-21f3e09a1feb.png)
![tst-d](https://cloud.githubusercontent.com/assets/7837760/8328773/f72bcf66-1a73-11e5-86ba-574cc186a063.png)

:+1: x 4

Awesome :astonished: 

Wypas @subgrafik !

Each of this images should contain Mirumee logo (perhaps the framed one, similar to how we brand our Twitter marketing materials).

@subgrafik try to provide @paweltin with images ready to check-in (optimized for size, color profiles stripped etc.) by Friday

![a01](https://cloud.githubusercontent.com/assets/7837760/11338636/a49a5be2-91f5-11e5-9b71-32222bde6a69.png)
![a02](https://cloud.githubusercontent.com/assets/7837760/11338637/a49c15c2-91f5-11e5-97d1-fcc98f76fa00.png)
![a03](https://cloud.githubusercontent.com/assets/7837760/11338638/a49d433e-91f5-11e5-9fe0-9ec8d5a5061a.png)
![a04](https://cloud.githubusercontent.com/assets/7837760/11338640/a4a0a48e-91f5-11e5-9ad6-0ef474e2fdad.png)
![a05](https://cloud.githubusercontent.com/assets/7837760/11338641/a4a1b8a6-91f5-11e5-83a3-d7f8d40af1f6.png)
![a06](https://cloud.githubusercontent.com/assets/7837760/11338639/a49fd306-91f5-11e5-8526-3863362f39a8.png)

koszulki nie zyskuja w wektorze .. wiec nie me czy nie zrobimy foto bazy /// 
formatkla do szerowania wygladala by jakos tak 
![skladka-share](https://cloud.githubusercontent.com/assets/7837760/11338695/e257ce38-91f5-11e5-84cf-ad58029581dc.png)

https://github.com/mirumee/saleor-product-mockups


Resolving patch:
diff --git a/utils/create_random_data.py b/utils/create_random_data.py
--- a/utils/create_random_data.py
+++ b/utils/create_random_data.py
@@ -4,8 +4,10 @@
 import unicodedata
 
 from faker import Factory
+from faker.providers import BaseProvider
 from django.conf import settings
 from django.core.files import File
+from prices import Price
 
 from saleor.order.models import Order, OrderedItem, DeliveryGroup, Payment
 from saleor.product.models import (Product, ProductVariant, ProductImage, Stock)
@@ -16,6 +18,13 @@
 STOCK_LOCATION = 'default'
 
 
+class FakePriceProvider(BaseProvider):
+    def price(self):
+        return Price(fake.pydecimal(2, 2, positive=True),
+                     currency=settings.DEFAULT_CURRENCY)
+fake.add_provider(FakePriceProvider)
+
+
 def get_email(first_name, last_name):
     _first = unicodedata.normalize('NFD', first_name).encode('ascii', 'ignore')
     _last = unicodedata.normalize('NFD', last_name).encode('ascii', 'ignore')
@@ -25,8 +34,7 @@ def get_email(first_name, last_name):
 
 def get_or_create_category(name, **kwargs):
     defaults = {
-        'description': fake.text()
-    }
+        'description': fake.text()}
     defaults.update(kwargs)
     defaults['slug'] = fake.slug(name)
 
@@ -36,47 +44,39 @@ def get_or_create_category(name, **kwargs):
 def create_product(**kwargs):
     defaults = {
         'name': fake.company(),
-        'price': fake.pyfloat(2, 2, positive=True),
+        'price': fake.price(),
         'weight': fake.random_digit(),
-        'description': '\n\n'.join(fake.paragraphs(5))
-    }
+        'description': '\n\n'.join(fake.paragraphs(5))}
     defaults.update(kwargs)
     return Product.objects.create(**defaults)
 
 
-def create_variant(product, **kwargs):
+def create_stock(variant, **kwargs):
     defaults = {
-        'name': fake.word(),
-        'sku': fake.random_int(1, 100000),
-        'product': product,
-    }
+        'variant': variant,
+        'location': STOCK_LOCATION,
+        'quantity': fake.random_int(1, 50)}
     defaults.update(kwargs)
-    return ProductVariant.objects.create(**defaults)
-
-
-def create_stock(product, **kwargs):
-    for variant in product.variants.all():
-        _create_stock(variant, **kwargs)
+    return Stock.objects.create(**defaults)
 
 
-def _create_stock(variant, **kwargs):
+def create_variant(product, **kwargs):
     defaults = {
-        'variant': variant,
-        'location': STOCK_LOCATION,
-        'quantity': fake.random_int(1, 50)
-    }
+        'name': fake.word(),
+        'sku': fake.random_int(1, 100000),
+        'product': product}
     defaults.update(kwargs)
-    return Stock.objects.create(**defaults)
+    variant = ProductVariant.objects.create(**defaults)
+    create_stock(variant)
+    return variant
 
 
 def create_product_image(product, placeholder_dir):
-    img_path = "%s/%s" % (placeholder_dir,
+    img_path = '%s/%s' % (placeholder_dir,
                           random.choice(os.listdir(placeholder_dir)))
     image = ProductImage(
         product=product,
-        image=File(open(img_path, 'rb'))
-    ).save()
-
+        image=File(open(img_path, 'rb'))).save()
     return image
 
 
@@ -93,18 +93,13 @@ def create_items(placeholder_dir, how_many=10):
     for i in range(how_many):
         product = create_product()
         product.categories.add(default_category)
-
-        create_variant(product)  # ensure at least one variant
         if create_images:
             create_product_images(
                 product, random.randrange(1, 5), placeholder_dir)
-
-        for _ in range(random.randrange(1, 5)):
-            if random.choice([True, False]):
-                create_variant(product)
-
-        create_stock(product)
-        yield "Product - %s %s Variants" % (product, product.variants.count())
+        num_variants = random.randrange(1, 5)
+        for _ in range(num_variants):
+            create_variant(product)
+        yield 'Product: %s, %s variant(s)' % (product, num_variants)
 
 
 def create_address():
@@ -160,7 +155,7 @@ def create_delivery_group(order):
     delivery_group = DeliveryGroup.objects.create(
         status=random.choice(['new', 'shipped']),
         order=order,
-        shipping_price=fake.pyfloat(1, 2, positive=True))
+        shipping_price=fake.price())
     return delivery_group
 
 
@@ -216,10 +211,10 @@ def create_fake_order():
 def create_users(how_many=10):
     for i in range(how_many):
         user = create_fake_user()
-        yield "User - %s" % user.email
+        yield 'User: %s' % (user.email,)
 
 
 def create_orders(how_many=10):
     for i in range(how_many):
         order = create_fake_order()
-        yield "Order - %s" % order
+        yield 'Order: %s' % (order,)


Test patch: