A package for synchronising Django models with Shopify resources.
This is a maintained fork of https://github.com/discolabs/django-shopify-sync
pip install django-shopify-sync
- Create a new
shopify_sync.Sessionin Django admin or shell, enter your Shopify admin API token and site name.
Where to get these fields:
- API Token: In the Shopify admin, this is caleld “API Key Password”.
- Site name: If your domain is http://my-site.myshopify.com your site name is my-site.
This package supports Python 3.X and Django>=1.11
How to use
First we will get some of the products from shopify
from shopify_sync.models import Product, Session session = Session.objects.first() # Assuming you have just one that you made previously products = Product.objects.sync_all(session, 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
products stored locally. Now to update from Django
product = Product.objects.first() product.title = "New Bar Foo" product.save(push=True)
save method on the objects also accepts the optional argument
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 will get a local copy of the shopify_resource and then
.reload() on it so that we make a request to shopify. Then we sync
that back with our database.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size django_shopify_sync-2.2.8-py3-none-any.whl (39.7 kB)||File type Wheel||Python version 3.7||Upload date||Hashes View hashes|
|Filename, size django-shopify-sync-2.2.8.tar.gz (23.5 kB)||File type Source||Python version None||Upload date||Hashes View hashes|
Hashes for django_shopify_sync-2.2.8-py3-none-any.whl
Hashes for django-shopify-sync-2.2.8.tar.gz