{ "info": { "author": "Jose ER", "author_email": "srj9es@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "|Build Status|\ndjango-swapfield\n================\n\n| Easy! When you use django-swapfield if the value is saved in other\n record, values are swapped! You can configure what\n| conditions must be repeated in both records to make the change.\n\nHow to\n======\n\n| ~~~~ {.sourceCode .bash}\n| $ pip install django-swapfield\n| $ # Define a SwapIntegerField in your model with unique\\_for\\_fields\n param (fields coincidence to can swap values)\n| $ # That SwapIntegerField can\u2019t be a part of unique\\_together or\n unique restriction.\n| ~~~~\n\nUses e.g.\n=========\n\n- Uniform number in sport team.\n- Race number in an athletic competition.\n- Any scenario when you want to swap values without reordering.\n\nexample\n=======\n\n| ~~~~ {.sourceCode .bash}\n| from swapfield.fields import SwapIntegerField\n\n| class Player(models.Model):\n| name = models.CharField(max\\_length=30)\n| team = models.ForeignKey(Team)\n| number = SwapIntegerField(unique\\_for\\_fields=[\u2018team\u2019])\n| # can swap \u201cnumber\u201d if \u201cteam\u201d has the same value\n| ~~~~\n\nAvailable fields\n================\n\n- SwapIntegerField\n\nMethod\n======\n\n- Current status allow swap values if not exists\n unique/unique\\_together restriction. First, get the registry (if\n exists)\n what contains the new value to assign it the old value from registry\n what currently is saving. When current registry is\n saved, replace the other registry with old value.\n- In next versions, other method will be used when exists\n unique/unique\\_together restriction.\n\nto-do list\n==========\n\n- [ ] Two or more django-swapfield in the same object.\n- [ ] Alternative method when exists unique/unique\\_together\n restriction\n- [ ] Friendly validation error with Django Admin (no Fatal error)\n- [ ] Abstract django-swap-field\n- [ ] SwapCharField\n- [x] Tests for functionality\n- [ ] Tests for migrations\n- [ ] Config setting to choose swap value when a new record (not\n edited) get a value that exists in database: choose the\n max value +1 or the first available.\n\n.. |Build Status| image:: https://travis-ci.org/SRJ9/django-swapfield.svg?branch=master\n :target: https://travis-ci.org/SRJ9/django-swapfield", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/SRJ9/django-swapfield/archive/master.zip", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/SRJ9/django-swapfield.git", "keywords": "Django,field,integer,swap", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-swapfield", "package_url": "https://pypi.org/project/django-swapfield/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-swapfield/", "project_urls": { "Download": "https://github.com/SRJ9/django-swapfield/archive/master.zip", "Homepage": "https://github.com/SRJ9/django-swapfield.git" }, "release_url": "https://pypi.org/project/django-swapfield/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "Django field with automatic values swap", "version": "0.1.1" }, "last_serial": 2620739, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "b9ae4e161317d4a9a3dc6aa412635181", "sha256": "ba9bfb2baa35c17bc424869aac109e05c02cd73ce0cf4d36d4c824d830e9e7f8" }, "downloads": -1, "filename": "django-swapfield-0.1.0.tar.gz", "has_sig": false, "md5_digest": "b9ae4e161317d4a9a3dc6aa412635181", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7146, "upload_time": "2017-02-05T15:24:35", "url": "https://files.pythonhosted.org/packages/94/c7/74370a526884a705469d0d00ce5ce5bc978d9a89693b936fa83c372d8eb6/django-swapfield-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "89e39ede4eabf3e8404f9a4e6ded917f", "sha256": "9e6cd6d4c32d5a0927fa23bf670ebbbc525aa36928b81199c3ac025d23ddfefa" }, "downloads": -1, "filename": "django-swapfield-0.1.1.tar.gz", "has_sig": false, "md5_digest": "89e39ede4eabf3e8404f9a4e6ded917f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7161, "upload_time": "2017-02-05T16:43:29", "url": "https://files.pythonhosted.org/packages/be/f0/dcb9ea1d28b43ff2ee1cae6a25c67cad0dc9564f95e508d18fec2f085fc0/django-swapfield-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "89e39ede4eabf3e8404f9a4e6ded917f", "sha256": "9e6cd6d4c32d5a0927fa23bf670ebbbc525aa36928b81199c3ac025d23ddfefa" }, "downloads": -1, "filename": "django-swapfield-0.1.1.tar.gz", "has_sig": false, "md5_digest": "89e39ede4eabf3e8404f9a4e6ded917f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7161, "upload_time": "2017-02-05T16:43:29", "url": "https://files.pythonhosted.org/packages/be/f0/dcb9ea1d28b43ff2ee1cae6a25c67cad0dc9564f95e508d18fec2f085fc0/django-swapfield-0.1.1.tar.gz" } ] }