Skip to main content

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

  1. pip install django-shopify-sync

  2. Add 'shopify_sync', to INSTALLED_APPS

  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-shopify-sync-2.2.3.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

django_shopify_sync-2.2.3-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file django-shopify-sync-2.2.3.tar.gz.

File metadata

  • Download URL: django-shopify-sync-2.2.3.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/38.5.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for django-shopify-sync-2.2.3.tar.gz
Algorithm Hash digest
SHA256 c698fd126d8847a8bc7a96ef9825f15efb27030670ab646d3e30a65652c42689
MD5 a26071207a71bb7c06223e6c9284123f
BLAKE2b-256 c9e80951391e71768f9911ceabc4020d445af4b83e310f74fd71268219c54d41

See more details on using hashes here.

File details

Details for the file django_shopify_sync-2.2.3-py3-none-any.whl.

File metadata

  • Download URL: django_shopify_sync-2.2.3-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/38.5.2 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for django_shopify_sync-2.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3c09bd7bee6faa019a9a3e776d363139adc9af46ff1bdc303effbf8dd3169a
MD5 2d1d4da844cb22a0437117f6c9dea43d
BLAKE2b-256 e3399cd52ede59bc01eb7afe5002dbd9b0f77b8c8ace0768618f441f2b9505c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page