{ "info": { "author": "Simon de Haan", "author_email": "UNKNOWN", "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": "===================\nDjango Dirty 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_dirty``\n * ``dirty_fields``\n\n\nInstalling\n==========\n\nInstall the package using pip_. Then use the instructions in \"Using the Mixin in the Model\".\n\n::\n\n $ pip install django-dirtyfields\n\nor if you're interested in developing it, use virtualenv_. The default ``settings.py`` will look for the dirtyfields package in its current location.\n\n::\n\n $ virtualenv --no-site-packages ve/\n $ source ve/bin/activate\n (ve)$ cd example_app\n (ve)$ pip install -r requirements.pip\n (ve)$ ./manage.py test testing_app\n\n\n.. _pip: http://www.pip-installer.org/en/latest/\n.. _virtualenv: https://pypi.python.org/pypi/virtualenv\n\n\n\nUsing the Mixin in the Model\n============================\n\n::\n\n from django.db import models\n from dirtyfields import DirtyFieldsMixin\n\n class TestModel(DirtyFieldsMixin, models.Model):\n \"\"\"A simple test model to test dirty fields mixin with\"\"\"\n boolean = models.BooleanField(default=True)\n characters = models.CharField(blank=True, max_length=80)\n\n\nUsing it in the shell\n=====================\n\n::\n\n (ve)$ ./manage.py shell\n >>> from testing_app.models import TestModel\n >>> tm = TestModel(boolean=True, characters=\"testing\")\n >>> tm.save()\n >>> tm.is_dirty\n False\n >>> tm.dirty_fields\n ()\n >>> tm.boolean = False\n >>> tm.is_dirty\n True\n >>> tm.dirty_fields\n ('boolean', )\n >>> tm.characters = \"have changed\"\n >>> tm.is_dirty\n True\n >>> tm.dirty_fields\n ('boolean', 'characters', )\n >>> tm.save()\n >>> tm.is_dirty\n False\n >>> tm.get_dirty_fields\n ()\n\nWhy would you want this?\n========================\n\nWhen using signals_, especially pre_save_, it is useful to be able to see what fields have changed or not. A signal could change its behaviour depending on whether a specific field has changed, whereas otherwise, you only could work on the event that the model's `save()` method had been called.\n\nCredits\n=======\n\nThis code has largely be adapted from what was made available at `Stack Overflow`_.\n\n.. _Stack Overflow: http://stackoverflow.com/questions/110803/dirty-fields-in-django\n.. _signals: http://docs.djangoproject.com/en/1.2/topics/signals/\n.. _pre_save: http://docs.djangoproject.com/en/1.2/ref/signals/#django.db.models.signals.pre_save", "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/smn/django-dirtyfields", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "caldwell-dirtyfields", "package_url": "https://pypi.org/project/caldwell-dirtyfields/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/caldwell-dirtyfields/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/smn/django-dirtyfields" }, "release_url": "https://pypi.org/project/caldwell-dirtyfields/0.5b1/", "requires_dist": null, "requires_python": null, "summary": "Tracking dirty fields on a Django model instance", "version": "0.5b1" }, "last_serial": 787206, "releases": { "0.3b1": [], "0.5b0": [], "0.5b1": [ { "comment_text": "", "digests": { "md5": "784747af7552959c88045c1e88b46d91", "sha256": "19ff0937380da1756ec22b73682a94427874bc994aa351f17c7a8da86fd1899b" }, "downloads": -1, "filename": "caldwell-dirtyfields-0.5b1.tar.gz", "has_sig": true, "md5_digest": "784747af7552959c88045c1e88b46d91", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8489, "upload_time": "2013-03-27T15:02:07", "url": "https://files.pythonhosted.org/packages/ce/1e/f245ba72aa7c7fe505913229a7193dc2e9de03db445e67fbd92e682b46d5/caldwell-dirtyfields-0.5b1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "784747af7552959c88045c1e88b46d91", "sha256": "19ff0937380da1756ec22b73682a94427874bc994aa351f17c7a8da86fd1899b" }, "downloads": -1, "filename": "caldwell-dirtyfields-0.5b1.tar.gz", "has_sig": true, "md5_digest": "784747af7552959c88045c1e88b46d91", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8489, "upload_time": "2013-03-27T15:02:07", "url": "https://files.pythonhosted.org/packages/ce/1e/f245ba72aa7c7fe505913229a7193dc2e9de03db445e67fbd92e682b46d5/caldwell-dirtyfields-0.5b1.tar.gz" } ] }