Skip to content

Instantly share code, notes, and snippets.

@rightx2
Last active March 9, 2017 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rightx2/6a04fcd897f1d70a1431223decae27f9 to your computer and use it in GitHub Desktop.
Save rightx2/6a04fcd897f1d70a1431223decae27f9 to your computer and use it in GitHub Desktop.
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