Last active
March 9, 2017 10:29
-
-
Save rightx2/6a04fcd897f1d70a1431223decae27f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from django.core.files import File | |
p = File(open('/Users/Chois/Desktop/1555555.jpeg', 'rb')) | |
PortfolioImage.objects.create(portfolio=Portfolio.objects.first(), image=p) | |
for i in range(49): | |
a = Portfolio.objects.create( | |
name=str(i) | |
) | |
a.portfolioimage_set.create( | |
image=p | |
) | |
import os | |
from django.core.files import File | |
image1 = File(open('/Users/Chois/Desktop/1555555.jpeg', 'rb')) | |
image2 = File(open('/Users/Chois/Desktop/1666666.jpeg', 'rb')) | |
single_option = Option.objects.last() | |
black_option = Option.objects.filter(name="black").first() | |
for i in range(8): | |
name = 'namasasdfdfe' + str(i) | |
product = Product.objects.create( | |
name=name, | |
) | |
product.tag_set.add( | |
Tag.objects.first() | |
) | |
product.variation_set.create( | |
option=black_option, | |
draft_image=image1, | |
applied_image=image2 | |
) | |
product.variation_set.create( | |
option=single_option, | |
draft_image=image2, | |
applied_image=image1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment