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
In create a new shopify_sync.Session in Django admin or shell. Enter your Shopify admin API token and 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-1.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5e224cd4072955c807f1fb0bd8b1aae4e06afaaa0fde345dad0dee4dc9ffc77 |
|
MD5 | 7ed6f3a9539d52679f9fdb677a58065e |
|
BLAKE2b-256 | 4328f0bac5ab0a352dfb9b4d47614c5c1e8301e7a987d7433e1ce30f02df2457 |
Hashes for django_shopify_sync-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec2e8877e0e0a602712e12a383391b64dff063e239bbd8f9e045f5cf93afd201 |
|
MD5 | 96b1c6e6ab9d6a855b542aad152d3464 |
|
BLAKE2b-256 | 51cc13db46308deaca32b03701332e562d5fe188d15b440039828f87cda7c15e |