Skip to content

A package for synchronising Django models with Shopify resources.

License

Notifications You must be signed in to change notification settings

HandyCodeJob/django-shopify-sync

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

149 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Shopify Sync

Readme will be added here.

WIP

How to use

First we will get some of the products from shopify

from shopify_sync.models import Product
products = Product.objects.sync_all(query="For bar")

sync_all passes all kwargs to the shopify_resource.find so we can then sync only the items that shopify returns from that search. Now we have all of the products stored locally. Now to update from Django

product = Product.objects.first()
product.title = "New Bar Foo"
product.save(push=True)

The save method on the objects also accepts the optional argument push which will push the updated model that is locally to Shopify. Now if a product was edited on shopify through some means other than this Django app, we will not have the current updated model. For this we need to sync

changed_product.sync()

the changed_product will get a local copy of the shopify_resource and then do a .reload() on it so that we make a request to shopify. Then we sync that back with our database.

About

A package for synchronising Django models with Shopify resources.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%