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

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-1.0.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_shopify_sync-1.0.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-shopify-sync-1.0.0.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for django-shopify-sync-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d24300cfa2092701bfddde9821798565adf72d65a17ec2baf843e477d4e6ed62
MD5 9e35fbde81a09e76c6668f4b406d305b
BLAKE2b-256 bb91053b116becc7b9028060d8d8314b4388e3c666954e03bcc61a24629b341a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_shopify_sync-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b5097ff2f2494b0bb99b9380aa4a4f3b6f65be623ea922d222003a28d28226b
MD5 2438ef626b4c1baca037159a64db1186
BLAKE2b-256 659a63c53a3d23ab190ce77fe931732211b28649499e586e1e4af3251f1faf6a

See more details on using hashes here.

Supported by

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