{ "info": { "author": "Simon de Haan & Corey Oordt & Bryan Helmig", "author_email": "bryan@zapier.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Django Stale Fields\n===================\n\nTracking changed fields on a Django model instance.\n\nMakes a Mixin available that will give you the properties:\n\n- `is_stale`\n- `stale_fields`\n\nAs well as the methods:\n\n- `save_stale()`\n\nWhich will will selectively only update stale columns using the familiar\n`Model.objects.filter(pk=pk).update(**stale_fields)` pattern (but still\nresolves `F()` or `auto_now` constructs).\n\n\n## Installing\n\nInstall the package using [pip][]. Then use the instructions in \"Using\nthe Mixin in the Model\".\n\n```\n$ pip install django-stalefields\n```\n\nor if you're interested in developing it, use [virtualenv][] and\n[virtualenvwrapper][]. The default `settings.py` will look for the\nstalefields package in its current location.\n\n```\n$ mkvirtualenv django-stalefields\n(django-stalefields)$ pip install -r example_app/requirements.pip\n(django-stalefields)$ example_app/manage.py test testing_app\n```\n\n\n## Auto-Mixin For All Models\n\nYou need to set make two `settings.py` tweaks:\n\n```python\n# settings.py\n\n\nINSTALLED_APPS = (\n 'stalefields', # must be first!\n\n # the rest...\n)\n\nAUTO_STALE_FIELDS = True\n```\n\nThis provides the methods and functionality *automatically* for all\nregistered models.\n\n\n## Manual Mixin in the Model\n\n```python\nfrom django.db import models\nfrom stalefields import StaleFieldsMixin\n\nclass TestModel(StaleFieldsMixin, models.Model):\n \"\"\"A simple test model to test stale fields mixin with\"\"\"\n boolean = models.BooleanField(default=True)\n characters = models.CharField(blank=True, max_length=80)\n```\n\n\n## Using it in the shell\n\n```python\n(django-stalefields)$ ./manage.py shell\n>>> from testing_app.models import TestModel\n>>> tm = TestModel(boolean=True, characters=\"testing\")\n>>> tm.save()\n>>> tm.is_stale\nFalse\n>>> tm.stale_fields\n()\n>>> tm.boolean = False\n>>> tm.is_stale\nTrue\n>>> tm.stale_fields\n('boolean', )\n>>> tm.characters = \"have changed\"\n>>> tm.is_stale\nTrue\n>>> tm.stale_fields\n('boolean', 'characters', )\n>>> tm.save_dirty() # just saves the dirty fields via .update()\n>>> tm.is_stale\nFalse\n>>> tm.get_stale_fields\n()\n```\n\n\n## Why would you want this?\n\nThree reasons:\n\n* Convenience\n* Optimization\n* Bug avoidance\n\nWhen using [signals][], especially [pressave][], it is useful to be able\nto see what fields have changed or not. A signal could change its\nbehaviour depending on whether a specific field has changed, whereas\notherwise, you only could work on the event that the model's save()\nmethod had been called.\n\nAny time you call boring old `save()` inside Django, all columns are inserted\nonce again, which can be very heavy if, for example, you have lots of text in one\ncolumn or many indexes that don't need to be needlessly checked for updating. Only\nupdating changing columns via `update()` is much faster, but requires lots of state\nmonitoring of your own accord. Put simply, this is nicer you your database!\n\nFinally, if multiple threads call `save()` for different operations, only the more\nrecent thread wins. If they both INSERTED only their column's changing values, that wouldn't\nbe an issue! These kinds of bugs are a nightmare to chase down...\n\n\n## Credits\n\nThis code has largely be adapted from what was made available at [Stack Overflow][] and adapted from Forked from https://github.com/smn/django-dirtyfields and https://github.com/callowayproject/django-dirtyfields..\n\n\n [pip]: http://www.pip-installer.org/en/latest/\n [virtualenv]: https://pypi.python.org/pypi/virtualenv\n [virtualenvwrapper]: https://pypi.python.org/pypi/virtualenvwrapper\n [signals]: http://docs.djangoproject.com/en/1.2/topics/signals/\n [pressave]: http://docs.djangoproject.com/en/1.2/ref/signals/#django.db.models.signals.pre_save\n [Stack Overflow]: http://stackoverflow.com/questions/110803/stale-fields-in-django", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/zapier/django-stalefields", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "django-stalefields", "package_url": "https://pypi.org/project/django-stalefields/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-stalefields/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/zapier/django-stalefields" }, "release_url": "https://pypi.org/project/django-stalefields/0.8.5/", "requires_dist": null, "requires_python": null, "summary": "Tracking stale fields on a Django model instance", "version": "0.8.5" }, "last_serial": 3674965, "releases": { "0.5b1": [ { "comment_text": "", "digests": { "md5": "c18171d7e6f69922fdf50df42a853910", "sha256": "6990c95ccdb066077157937839473f5052955551b927e7c3a9465d90d514b795" }, "downloads": -1, "filename": "django-stalefields-0.5b1.tar.gz", "has_sig": false, "md5_digest": "c18171d7e6f69922fdf50df42a853910", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8524, "upload_time": "2013-10-05T02:09:55", "url": "https://files.pythonhosted.org/packages/fc/3e/1ca5c4e0d8440bde4ce6020ae0143e051ed82fa46a4a8be3cb4b6022b7eb/django-stalefields-0.5b1.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "cf90ea1ddd16849b7c7d2c2d93e32495", "sha256": "e98253608768bb6316121058b8d200024b421ceb71f4d24329994cb3de45d200" }, "downloads": -1, "filename": "django-stalefields-0.6.tar.gz", "has_sig": false, "md5_digest": "cf90ea1ddd16849b7c7d2c2d93e32495", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8990, "upload_time": "2013-10-05T21:25:16", "url": "https://files.pythonhosted.org/packages/0d/20/a97c46d3591e9ad32f84697a0b3170fa8d93c37f0c3ce8dd79dddd921eeb/django-stalefields-0.6.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "1ff51902075ac2c7fa9bf93e02fea743", "sha256": "3abff2e9cdf571df590bf5062dc8c220f55973f6db827164c49b434e76645e51" }, "downloads": -1, "filename": "django-stalefields-0.8.tar.gz", "has_sig": false, "md5_digest": "1ff51902075ac2c7fa9bf93e02fea743", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9195, "upload_time": "2013-10-05T23:27:06", "url": "https://files.pythonhosted.org/packages/97/75/1f08398f7779aec2477f42e0cef296c4e05e9d0fbf26a60e3261daa575c1/django-stalefields-0.8.tar.gz" } ], "0.8.1": [ { "comment_text": "", "digests": { "md5": "35f7ecaea4880259d17d9a4deb7c8a30", "sha256": "d853208d8fc97e84f763cb5c5dbd057294a5d2a431d0f0c84e427d337da88e3d" }, "downloads": -1, "filename": "django-stalefields-0.8.1.tar.gz", "has_sig": false, "md5_digest": "35f7ecaea4880259d17d9a4deb7c8a30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9547, "upload_time": "2013-10-05T23:48:48", "url": "https://files.pythonhosted.org/packages/55/83/21629f697c6775d99bdcbb24cd0543c39d2933bd34bc1e567fe43b1ccb0f/django-stalefields-0.8.1.tar.gz" } ], "0.8.2": [ { "comment_text": "", "digests": { "md5": "1d4590197b60953c7752acae6c273fab", "sha256": "e9a48453e8961c815a09b3ce4e872596cadaed090e6ac10422394449dabf4b27" }, "downloads": -1, "filename": "django-stalefields-0.8.2.tar.gz", "has_sig": false, "md5_digest": "1d4590197b60953c7752acae6c273fab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9544, "upload_time": "2013-10-06T00:04:13", "url": "https://files.pythonhosted.org/packages/6b/86/8d2bc7ee0294c5f4339ff7782cfdaa1dc3549bf97e48e25ceaa6e97c5185/django-stalefields-0.8.2.tar.gz" } ], "0.8.3": [ { "comment_text": "", "digests": { "md5": "beb65ed8afcbd3cc62ee63cd07fb9592", "sha256": "9ee727884220d61ff2d3b99c2978c36c12d5c4e17000dddc3253e1643c995ce3" }, "downloads": -1, "filename": "django-stalefields-0.8.3.tar.gz", "has_sig": false, "md5_digest": "beb65ed8afcbd3cc62ee63cd07fb9592", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9542, "upload_time": "2013-10-06T00:06:50", "url": "https://files.pythonhosted.org/packages/6a/69/de950eef0ce9471f2ad736a9c9e694cf0ee20876f58a41e533877a7fca7f/django-stalefields-0.8.3.tar.gz" } ], "0.8.4": [ { "comment_text": "", "digests": { "md5": "a7caf811d99c5c7987099b0ffa18d3c9", "sha256": "0fa8938a8184cd62c4dfd8ef459ae9ad09b20ee2cf169454dc5edf998168aa5b" }, "downloads": -1, "filename": "django-stalefields-0.8.4.tar.gz", "has_sig": false, "md5_digest": "a7caf811d99c5c7987099b0ffa18d3c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9657, "upload_time": "2013-10-07T04:26:42", "url": "https://files.pythonhosted.org/packages/07/96/656c2369a5c096613cb6954192496d40d1cad2f22b4214379316fcd81f86/django-stalefields-0.8.4.tar.gz" } ], "0.8.5": [ { "comment_text": "", "digests": { "md5": "f50c702e5d03db02bea996f641e466c9", "sha256": "b54a15e9c909f816e6355a96172f0f973a1bcbe70a8d9d8e626af55ba6a41c23" }, "downloads": -1, "filename": "django-stalefields-0.8.5.tar.gz", "has_sig": false, "md5_digest": "f50c702e5d03db02bea996f641e466c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9686, "upload_time": "2013-11-13T21:16:15", "url": "https://files.pythonhosted.org/packages/56/6c/5e55c785f0cdfe8f7f2dbd458d2dc72bf03e4142e33d484402fe4963440b/django-stalefields-0.8.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f50c702e5d03db02bea996f641e466c9", "sha256": "b54a15e9c909f816e6355a96172f0f973a1bcbe70a8d9d8e626af55ba6a41c23" }, "downloads": -1, "filename": "django-stalefields-0.8.5.tar.gz", "has_sig": false, "md5_digest": "f50c702e5d03db02bea996f641e466c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9686, "upload_time": "2013-11-13T21:16:15", "url": "https://files.pythonhosted.org/packages/56/6c/5e55c785f0cdfe8f7f2dbd458d2dc72bf03e4142e33d484402fe4963440b/django-stalefields-0.8.5.tar.gz" } ] }