Skip to content

Instantly share code, notes, and snippets.

@raccoonyy
Created May 20, 2016 02:24
Show Gist options
  • Save raccoonyy/b1aa0c36bfcf2f207737b72efadcc0a4 to your computer and use it in GitHub Desktop.
Save raccoonyy/b1aa0c36bfcf2f207737b72efadcc0a4 to your computer and use it in GitHub Desktop.
실습용 데이터 생성
from product.models import Product, OrderLog
animal = Product.objects.create(name='동물동요', price=8200)
pack = Product.objects.create(name='사운드북 패키지', price=38400)
abc = Product.objects.create(name='ABC Activity', price=9900)
import datetime
may1 = datetime.datetime(2016, 4, 1)
may2 = datetime.datetime(2016, 4, 2)
may3 = datetime.datetime(2016, 4, 3)
OrderLog.objects.bulk_create(
OrderLog(created=may1, product=abc),
OrderLog(created=may1, product=animal),
OrderLog(created=may1, product=pack),
OrderLog(created=may1, product=abc),
OrderLog(created=may1, product=animal),
OrderLog(created=may1, product=pack),
OrderLog(created=may2, product=pack),
OrderLog(created=may2, product=abc),
OrderLog(created=may2, product=abc),
OrderLog(created=may2, product=animal),
OrderLog(created=may2, product=abc),
OrderLog(created=may2, product=animal),
OrderLog(created=may3, product=animal),
OrderLog(created=may3, product=pack),
OrderLog(created=may3, product=animal),
OrderLog(created=may3, product=abc)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment