django-shopify-sync


Namedjango-shopify-sync JSON
Version 3.0.0 PyPI version JSON
download
home_pagehttps://gitlab.com/thelabnyc/django-shopify-sync
SummaryA package for synchronizing Django models with Shopify resources.
upload_time2024-08-31 18:32:27
maintainerNone
docs_urlNone
authorthelab
requires_python<4.0,>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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

```py
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

```py
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

```py
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](https://commitizen-tools.github.io/commitizen/commands/bump/) via the [bin/publish.sh](bin/publish.sh) script.

```sh
./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.


            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/thelabnyc/django-shopify-sync",
    "name": "django-shopify-sync",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "thelab",
    "author_email": "thelabdev@thelab.co",
    "download_url": "https://files.pythonhosted.org/packages/6b/d0/e0438a1caea4679cd8f9baed4c036873e4488ed1cbe69ddce76325c58174/django_shopify_sync-3.0.0.tar.gz",
    "platform": null,
    "description": "# Django Shopify Sync\n\nThis is a maintained fork of https://github.com/discolabs/django-shopify-sync\n\n## Installation\n\n1. `pip install django-shopify-sync`\n2. Add `'shopify_sync',` to `INSTALLED_APPS`\n3. Create a new `shopify_sync.Session` in Django admin or shell, enter your Shopify admin API token and site name.\n\nWhere to get these fields:\n\n- **API Token**: In the Shopify admin, this is caleld \"API Key Password\".\n- **Site name**: If your domain is http://my-site.myshopify.com your site name is my-site.\n\nThis package supports Python 3.X and Django>=4.2\n\n## How to use\n\nFirst we will get some of the products from Shopify\n\n```py\nfrom shopify_sync.models import Product, Session\nsession = Session.objects.first()  # Assuming you have just one that you made previously\nproducts = Product.objects.sync_all(session, query=\"For bar\")\n```\n\n`sync_all` passes all kwargs to the `shopify_resource.find` so we can\nthen sync only the items that shopify returns from that search. Now we have all\nof the `products` stored locally. Now to update from Django\n\n```py\nproduct = Product.objects.first()\nproduct.title = \"New Bar Foo\"\nproduct.save(push=True)\n```\n\nThe `save` method on the objects also accepts the optional argument `push`\nwhich will push the updated model that is locally to Shopify. Now if a product\nwas edited on shopify through some means other than this Django app, we will\nnot have the current updated model. For this we need to sync\n\n```py\nchanged_product.sync()\n```\n\nThe `changed_product` will get a local copy of the shopify_resource and then\ndo a `.reload()` on it so that we make a request to shopify. Then we sync\nthat back with our database.\n\n## How to publish a new version\n\nUse [commitizen](https://commitizen-tools.github.io/commitizen/commands/bump/) via the [bin/publish.sh](bin/publish.sh) script.\n\n```sh\n./bin/publish.sh\n```\n\n## Contributing\n\nThis 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.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package for synchronizing Django models with Shopify resources.",
    "version": "3.0.0",
    "project_urls": {
        "Homepage": "https://gitlab.com/thelabnyc/django-shopify-sync",
        "Repository": "https://gitlab.com/thelabnyc/django-shopify-sync"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ebf6765d260fa30be8ed0339e35e1db0f8f551d53b0e511924a39bce712f44b",
                "md5": "a75fa4ab2521fa1aa446996b82ee4548",
                "sha256": "17dbcd479e236d54ee537df8b0d383efdc74d236cf65d0c54a694d2a0527d40a"
            },
            "downloads": -1,
            "filename": "django_shopify_sync-3.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a75fa4ab2521fa1aa446996b82ee4548",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 44477,
            "upload_time": "2024-08-31T18:32:26",
            "upload_time_iso_8601": "2024-08-31T18:32:26.548895Z",
            "url": "https://files.pythonhosted.org/packages/2e/bf/6765d260fa30be8ed0339e35e1db0f8f551d53b0e511924a39bce712f44b/django_shopify_sync-3.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6bd0e0438a1caea4679cd8f9baed4c036873e4488ed1cbe69ddce76325c58174",
                "md5": "15ffdd93b12c4bd6061ac5f8a3e57dd7",
                "sha256": "62f17db843584b580a1c106f8e22e72a92f5c72e06f98b553611fd40a0299ca4"
            },
            "downloads": -1,
            "filename": "django_shopify_sync-3.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "15ffdd93b12c4bd6061ac5f8a3e57dd7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 27328,
            "upload_time": "2024-08-31T18:32:27",
            "upload_time_iso_8601": "2024-08-31T18:32:27.993728Z",
            "url": "https://files.pythonhosted.org/packages/6b/d0/e0438a1caea4679cd8f9baed4c036873e4488ed1cbe69ddce76325c58174/django_shopify_sync-3.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-31 18:32:27",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "thelabnyc",
    "gitlab_project": "django-shopify-sync",
    "lcname": "django-shopify-sync"
}
        
Elapsed time: 0.52421s