Commit 77925c32 authored by lizonr1's avatar lizonr1

Create sample promotions

parent 2aefa448
from App.loyaltyMe.models import Promotion
__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):
promotions = [
#[name, description, code, img, status]
['10%', 'Zniżka 10%', '5ac5','/static/media/img/photo_1.jpg' , 'New'],
['20%', 'Zniżka 20%', '5ac6','/static/media/img/photo_1.jpg' , 'New'],
['50%', 'Zniżka 50%', '5ac7','/static/media/img/photo_1.jpg' , 'New'],
]
print("Creating Promotions")
for promotion in promotions:
print('Create {0}'.format(promotion[0]))
new_promotion = Promotion.objects.create(name=promotion[0], description=promotion[1], code=promotion[2], img=promotion[3], status=promotion[4])
new_promotion.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