Name | django-dirtyfields JSON |
Version |
1.9.5
JSON |
| download |
home_page | None |
Summary | Tracking dirty fields on a Django model instance. |
upload_time | 2024-11-13 12:45:21 |
maintainer | Lincoln Puzey |
docs_url | None |
author | Romain Garrigues |
requires_python | >=3.9 |
license | Copyright (c) Praekelt Foundation and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the Praekelt Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
keywords |
django
dirtyfields
track
model
changes
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
===================
Django Dirty Fields
===================
.. image:: https://badges.gitter.im/Join%20Chat.svg
:alt: Join the chat at https://gitter.im/romgar/django-dirtyfields
:target: https://gitter.im/romgar/django-dirtyfields?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
.. image:: https://img.shields.io/pypi/v/django-dirtyfields.svg
:alt: Published PyPI version
:target: https://pypi.org/project/django-dirtyfields/
.. image:: https://github.com/romgar/django-dirtyfields/actions/workflows/tests.yml/badge.svg
:alt: Github Actions Test status
:target: https://github.com/romgar/django-dirtyfields/actions/workflows/tests.yml
.. image:: https://coveralls.io/repos/github/romgar/django-dirtyfields/badge.svg?branch=develop
:alt: Coveralls code coverage status
:target: https://coveralls.io/github/romgar/django-dirtyfields?branch=develop
.. image:: https://readthedocs.org/projects/django-dirtyfields/badge/?version=latest
:alt: Read the Docs documentation status
:target: https://django-dirtyfields.readthedocs.io/en/latest/
Tracking dirty fields on a Django model instance.
Dirty means that field in-memory and database values are different.
This package is compatible and tested with the following Python & Django versions:
+------------------------+-----------------------------------+
| Django | Python |
+========================+===================================+
| 2.2, 3.0, 3.1 | 3.9 |
+------------------------+-----------------------------------+
| 3.2, 4.0 | 3.9, 3.10 |
+------------------------+-----------------------------------+
| 4.1 | 3.9, 3.10, 3.11 |
+------------------------+-----------------------------------+
| 4.2 | 3.9, 3.10, 3.11, 3.12 |
+------------------------+-----------------------------------+
| 5.0 | 3.10, 3.11, 3.12 |
+------------------------+-----------------------------------+
| 5.1 | 3.10, 3.11, 3.12, 3.13 |
+------------------------+-----------------------------------+
Install
=======
.. code-block:: bash
$ pip install django-dirtyfields
Usage
=====
To use ``django-dirtyfields``, you need to:
- Inherit from ``DirtyFieldsMixin`` in the Django model you want to track.
.. code-block:: python
from django.db import models
from dirtyfields import DirtyFieldsMixin
class ExampleModel(DirtyFieldsMixin, models.Model):
"""A simple example model to test dirty fields mixin with"""
boolean = models.BooleanField(default=True)
characters = models.CharField(blank=True, max_length=80)
- Use one of these 2 functions on a model instance to know if this instance is dirty, and get the dirty fields:
* ``is_dirty()``
* ``get_dirty_fields()``
Example
-------
.. code-block:: python
>>> model = ExampleModel.objects.create(boolean=True,characters="first value")
>>> model.is_dirty()
False
>>> model.get_dirty_fields()
{}
>>> model.boolean = False
>>> model.characters = "second value"
>>> model.is_dirty()
True
>>> model.get_dirty_fields()
{'boolean': True, "characters": "first_value"}
Consult the `full documentation <https://django-dirtyfields.readthedocs.io/>`_ for more information.
Raw data
{
"_id": null,
"home_page": null,
"name": "django-dirtyfields",
"maintainer": "Lincoln Puzey",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "django, dirtyfields, track, model, changes",
"author": "Romain Garrigues",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/7c/c6/5f9a642ad623f8a66e538aadfa002a99561e794b20539575ac50c72bfda3/django_dirtyfields-1.9.5.tar.gz",
"platform": null,
"description": "===================\nDjango Dirty Fields\n===================\n\n.. image:: https://badges.gitter.im/Join%20Chat.svg\n :alt: Join the chat at https://gitter.im/romgar/django-dirtyfields\n :target: https://gitter.im/romgar/django-dirtyfields?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n.. image:: https://img.shields.io/pypi/v/django-dirtyfields.svg\n :alt: Published PyPI version\n :target: https://pypi.org/project/django-dirtyfields/\n.. image:: https://github.com/romgar/django-dirtyfields/actions/workflows/tests.yml/badge.svg\n :alt: Github Actions Test status\n :target: https://github.com/romgar/django-dirtyfields/actions/workflows/tests.yml\n.. image:: https://coveralls.io/repos/github/romgar/django-dirtyfields/badge.svg?branch=develop\n :alt: Coveralls code coverage status\n :target: https://coveralls.io/github/romgar/django-dirtyfields?branch=develop\n.. image:: https://readthedocs.org/projects/django-dirtyfields/badge/?version=latest\n :alt: Read the Docs documentation status\n :target: https://django-dirtyfields.readthedocs.io/en/latest/\n\nTracking dirty fields on a Django model instance.\nDirty means that field in-memory and database values are different.\n\nThis package is compatible and tested with the following Python & Django versions:\n\n\n+------------------------+-----------------------------------+\n| Django | Python |\n+========================+===================================+\n| 2.2, 3.0, 3.1 | 3.9 |\n+------------------------+-----------------------------------+\n| 3.2, 4.0 | 3.9, 3.10 |\n+------------------------+-----------------------------------+\n| 4.1 | 3.9, 3.10, 3.11 |\n+------------------------+-----------------------------------+\n| 4.2 | 3.9, 3.10, 3.11, 3.12 |\n+------------------------+-----------------------------------+\n| 5.0 | 3.10, 3.11, 3.12 |\n+------------------------+-----------------------------------+\n| 5.1 | 3.10, 3.11, 3.12, 3.13 |\n+------------------------+-----------------------------------+\n\n\n\nInstall\n=======\n\n.. code-block:: bash\n\n $ pip install django-dirtyfields\n\n\nUsage\n=====\n\nTo use ``django-dirtyfields``, you need to:\n\n- Inherit from ``DirtyFieldsMixin`` in the Django model you want to track.\n\n.. code-block:: python\n\n from django.db import models\n from dirtyfields import DirtyFieldsMixin\n\n class ExampleModel(DirtyFieldsMixin, models.Model):\n \"\"\"A simple example model to test dirty fields mixin with\"\"\"\n boolean = models.BooleanField(default=True)\n characters = models.CharField(blank=True, max_length=80)\n\n- Use one of these 2 functions on a model instance to know if this instance is dirty, and get the dirty fields:\n\n * ``is_dirty()``\n * ``get_dirty_fields()``\n\n\nExample\n-------\n\n.. code-block:: python\n\n >>> model = ExampleModel.objects.create(boolean=True,characters=\"first value\")\n >>> model.is_dirty()\n False\n >>> model.get_dirty_fields()\n {}\n\n >>> model.boolean = False\n >>> model.characters = \"second value\"\n\n >>> model.is_dirty()\n True\n >>> model.get_dirty_fields()\n {'boolean': True, \"characters\": \"first_value\"}\n\n\nConsult the `full documentation <https://django-dirtyfields.readthedocs.io/>`_ for more information.\n",
"bugtrack_url": null,
"license": "Copyright (c) Praekelt Foundation and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the Praekelt Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
"summary": "Tracking dirty fields on a Django model instance.",
"version": "1.9.5",
"project_urls": {
"Changelog": "https://github.com/romgar/django-dirtyfields/blob/develop/ChangeLog.rst",
"Documentation": "https://django-dirtyfields.readthedocs.io",
"Homepage": "https://github.com/romgar/django-dirtyfields",
"Repository": "https://github.com/romgar/django-dirtyfields.git"
},
"split_keywords": [
"django",
" dirtyfields",
" track",
" model",
" changes"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "503398b2d301e9167ca5bca286a2a153d0640a49e96fdb584e77cecf726afbd6",
"md5": "1ff16e680227eca4038c73b2b89a8e26",
"sha256": "d544e648df2f13256683c3e20b93f61672b63087acf3f81ee8cedb4b0482a8c1"
},
"downloads": -1,
"filename": "django_dirtyfields-1.9.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1ff16e680227eca4038c73b2b89a8e26",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 8445,
"upload_time": "2024-11-13T12:45:19",
"upload_time_iso_8601": "2024-11-13T12:45:19.984278Z",
"url": "https://files.pythonhosted.org/packages/50/33/98b2d301e9167ca5bca286a2a153d0640a49e96fdb584e77cecf726afbd6/django_dirtyfields-1.9.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7cc65f9a642ad623f8a66e538aadfa002a99561e794b20539575ac50c72bfda3",
"md5": "1daf5fdef580c16f3eddb2dbf94d3772",
"sha256": "c316ab2e12cfc9da16e714007f0b313d35c3216f6b90b7b1d66c50bf1f4f3f19"
},
"downloads": -1,
"filename": "django_dirtyfields-1.9.5.tar.gz",
"has_sig": false,
"md5_digest": "1daf5fdef580c16f3eddb2dbf94d3772",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 21664,
"upload_time": "2024-11-13T12:45:21",
"upload_time_iso_8601": "2024-11-13T12:45:21.003916Z",
"url": "https://files.pythonhosted.org/packages/7c/c6/5f9a642ad623f8a66e538aadfa002a99561e794b20539575ac50c72bfda3/django_dirtyfields-1.9.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 12:45:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "romgar",
"github_project": "django-dirtyfields",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-dirtyfields"
}