예제 #1
0
파일: views.py 프로젝트: dpetrillo740/scm
def update(request):
    products = shopify.Product.find(limit=50)
    for product in products:
        if product.attributes['published_at']:
            for variant in product.attributes['variants']:
                sku = Sku(sku=variant.sku, title=product.attributes['title'], variant=variant.title)
                sku.save()
    return HttpResponseRedirect("/")
예제 #2
0
 def handle(self, *args, **options):
     products = shopify.Product.find(limit=50)
     for product in products:
         if product.attributes['published_at']:
             for variant in product.attributes['variants']:
                 sku = Sku(sku=variant.sku, title=product.attributes['title'], variant=variant.title)
                 sku.save()
     self.stdout.write('Successfully updated the local DB')