Skip to main content

A package for synchronizing Django models with Shopify resources.

Project description

Django Shopify Sync

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>=4.2

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.

How to publish a new version

Use commitizen via the bin/publish.sh script.

./bin/publish.sh

Contributing

This project is in maintenance mode. Please do not post feature requests unless you intend to both implement them in a merge request and generally help maintain the project. A great first step would be a merge request to update base packages and ensure we are compatible with new Django versions.

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

Uploaded Source

Built Distribution

django_shopify_sync-3.0.0-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

Details for the file django_shopify_sync-3.0.0.tar.gz.

File metadata

  • Download URL: django_shopify_sync-3.0.0.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for django_shopify_sync-3.0.0.tar.gz
Algorithm Hash digest
SHA256 62f17db843584b580a1c106f8e22e72a92f5c72e06f98b553611fd40a0299ca4
MD5 15ffdd93b12c4bd6061ac5f8a3e57dd7
BLAKE2b-256 6bd0e0438a1caea4679cd8f9baed4c036873e4488ed1cbe69ddce76325c58174

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_shopify_sync-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17dbcd479e236d54ee537df8b0d383efdc74d236cf65d0c54a694d2a0527d40a
MD5 a75fa4ab2521fa1aa446996b82ee4548
BLAKE2b-256 2ebf6765d260fa30be8ed0339e35e1db0f8f551d53b0e511924a39bce712f44b

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