A package for synchronising Django models with Shopify resources.
Project description
This is a maintained fork of https://github.com/discolabs/django-shopify-sync
Installation
pip install django-shopify-sync
Add
'shopify_sync',
toINSTALLED_APPS
Create a new
shopify_sync.Session
in 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
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-shopify-sync-2.2.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bca15afabfa67bf0f40a9be57e57cf05114c115c251619e60a9c4e31484b82f |
|
MD5 | d608122320da07149f5986e442789cb5 |
|
BLAKE2b-256 | 59e202ed4acaf3eabdefe7cf772e0dce668e9338fb393fb434d044cdc31882e5 |
Hashes for django_shopify_sync-2.2.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28999b3f8b17efce0b7bbb0ede5304bf2d92048846d423cc397cc4900772cdf0 |
|
MD5 | 63cc328f7ff7091f27bd6f1642d568ac |
|
BLAKE2b-256 | 83ee3ea8c8b4520a276e10fd41672af2939bc2d9cf1556836aff73813408b1c1 |