Commit 742f7a9a authored by lizonr1's avatar lizonr1

Add sample products

parent 8cb82fea
from App.loyaltyMe.models import Product
__author__ = 'Rafal'
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Closes the specified poll for voting'
def handle(self, *args, **options):
products = [
#['name', 'description', 'price', 'img' ],
['Kawa Latte', 'Z nutą czekolady', '7 zł', '/static/media/img/photo_1.jpg'],
['Herbata', 'Z nutą czekolady', '4 zł', '/static/media/img/photo_1.jpg'],
['Ciasto', 'Z nutą czekolady', '5 zł', '/static/media/img/photo_1.jpg'],
['Espresso', 'Mała czarna', '5 zł', '/static/media/img/photo_1.jpg'],
]
print("Creating Products")
for product in products:
print('Create {0}'.format(product[0]))
new_product = Product.objects.create(name=product[0], description=product[1], price=product[2], img=product[3])
new_product.save()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment