- New:
- Confirm support for Django 6.0.
Note that Django 6.0 now refreshes or defers (depending on your database)
fields that are expressions after
Model.save(). A field that is refreshed by this mechanism will now appear as dirty if it is subsequently changed in-memory, when previously it wouldn't. See https://docs.djangoproject.com/en/6.0/ref/models/expressions/#f-assignments-are-refreshed-after-model-save and https://code.djangoproject.com/ticket/27222.
- Confirm support for Django 6.0.
Note that Django 6.0 now refreshes or defers (depending on your database)
fields that are expressions after
- New:
- Confirm support for Python 3.14
- Confirm support for Django 5.2
- Drop support for Python 3.9
- Drop support for Django 2.2
- Drop support for Django 3.0
- Drop support for Django 3.1
- Bugfix
- Fix
Model.refresh_from_db()so calling it with 3 positional args works.
- Fix
- Bugfix
- Allow passing
from_querysetargument toModel.refresh_from_db()in Django 5.1+
- Allow passing
- Bugfix
- Fixed error in PyPI publish process
- New:
- Confirm support for Python 3.13
- Confirm support for Django 5.1
- Drop support for Python 3.8
- New:
- Confirm support for Python 3.12
- Confirm support for Django 5.0
- Drop support for Python 3.7
- Drop support for Django 2.0
- Drop support for Django 2.1
- New:
- Confirm support for Django 4.2
- Bugfix:
- Fixed a
KeyErrorthat would occur when updating a field two times in a row when the field value is set to anFobject and the field is specified in theupdate_fieldsargument tosave(). (#209)
- Fixed a
- New:
- Confirm support for Python 3.11
- Confirm support for Django 4.1
- Drop support for Django 1.11
- Changed:
- The method
get_dirty_fields()now returns only the file name for FileFields. This is to improve performance, since the entireFieldFileobject will no longer be copied when Model instances are initialized and saved. (#203)
- The method
- Bugfix:
- The method
save_dirty_fields()can now be called on Model instances that have not been saved to the Database yet. In this case all fields will be considered dirty, and all will be saved to the Database. Previously doing this would result in an Exception being raised. (#200)
- The method
- Documentation:
- General improvements to content and generation of Documentation (#197).
- Documentation:
- Document limitations when using dirtyfields and database transactions (#148).
- Document how to use a Proxy Model to avoid performance impact (#132).
- New:
- Confirm support of Python 3.10
- Confirm support of Django 4.0
- Drop support for Python 3.6
- Tests
- Run CI tests on Github Actions since travis-ci.org has been shutdown.
- New:
- Provide programmatically accessible package version number. Use
dirtyfields.__version__for a string,dirtyfields.VERSIONfor a tuple. - Build and publish a wheel to PyPI.
- Provide programmatically accessible package version number. Use
- Changed:
- Only look at concrete fields when determining dirty fields.
- Migrate package metadata from setup.py to setup.cfg and specify the PEP-517 build-backend to use with the project.
- Bugfix:
- Fixed a
KeyErrorthat happened when saving a Model withupdate_fieldsspecified after updating a field value with anFobject (#118).
- Fixed a
- New:
- Confirm support of Django 3.2
- Changed:
- Remove pytz as a dependency.
- New:
- Drop support of Python 2.7
- Drop support of Python 3.5
- Confirm support of Python 3.8
- Confirm support of Python 3.9
- Confirm support of Django 3.0
- Confirm support of Django 3.1
- Bugfix:
- Fixes an issue when
refresh_from_dbwas called with thefieldsargument, the dirty state for all fields would be reset, even though only the fields specified are reloaded from the database. Now only the reloaded fields will have their dirty state reset (#154). - Fixes an issue where accessing a deferred field would reset the dirty state for all fields (#154).
- Fixes an issue when
- New:
- Drop support of Python 3.4
- Drop support of Django 1.8
- Drop support of Django 1.9
- Drop support of Django 1.10
- Confirm support of Python 3.7
- Confirm support of Django 2.0
- Confirm support of Django 2.1
- Confirm support of Django 2.2
- Bugfix:
- Fixes tests for Django 2.0
refresh_from_dbis now properly resetting dirty fields.- Adds
normalise_functionto provide control on how dirty values are stored
New:
- Updates python classifier in setup file (#116). Thanks amureki.
- Adds PEP8 validation in travisCI run (#123). Thanks hsmett.
Bugfix:
- Avoids
get_deferred_fieldsto be called too many times on_as_dict(#115). Thanks benjaminrigaud.- Respects
FIELDS_TO_CHECKin reset_state (#114). Thanks bparker98.
New:
- Drop support for unsupported Django versions: 1.4, 1.5, 1.6 and 1.7 series.
- Fixes issue with verbose mode when the object has not been yet saved in the database (MR #99). Thanks vapkarian.
- Add test coverage for Django 1.11.
- A new attribute
FIELDS_TO_CHECKhas been added toDirtyFieldsMixinto specify a limited set of fields to check.
Bugfix:
- Correctly handle
ForeignKey.db_column{}_idinupdate_fields. Thanks Hugo Smett.- Fixes #111: Eliminate a memory leak.
- Handle deferred fields in
update_fields
New:
django-dirtyfieldsis now tested with PostgreSQL, especially with specific fields
Bugfix:
- Fixes #80: Use of
Field.relraises warnings from Django 1.9+- Fixes #84: Use
only()in conjunction with 2 foreign keys triggers a recursion error- Fixes #77: Shallow copy does not work with Django 1.9's JSONField
- Fixes #88:
get_dirty_fieldson a newly-created model does not work if pk is specified- Fixes #90: Unmark dirty fields only listed in
update_fields
New:
django-dirtyfieldsis now compatible with Django 1.10 series (deferred field handling has been updated).
New:
- A new attribute
ENABLE_M2M_CHECKhas been added toDirtyFieldsMixinto enable/disable m2m check functionality. This parameter is set toFalseby default. IMPORTANT: backward incompatibility with v1.0.x series. If you were usingcheck_m2mparameter to check m2m relations, you should now addENABLE_M2M_CHECK = Trueto these models inheriting fromDirtyFieldsMixin. Check the documentation to see more details/examples.
Bugfix:
- Fixing a bug preventing
django-dirtyfieldsto work properly on models with custom primary keys.
After several years of existence, django-dirty-fields is mature enough to switch to 1.X version. There is a backward-incompatibility on this version. Please read careful below.
New:
- IMPORTANT:
get_dirty_fieldsis now more consistent for models not yet saved in the database.get_dirty_fieldsis, in that situation, always returning ALL fields, where it was before returning various results depending on how you initialised your model. It may affect you specially if you are usingget_dirty_fieldsin apre_savereceiver. See more details at #65.- Adding compatibility for old _meta API, deprecated in Django 1.10 version and now replaced by an official API.
- General test cleaning.
New:
- Adding Many-to-Many fields comparison method
check_m2minDirtyFieldsMixin.- Adding
verboseparameter inget_dirty_fieldsmethod to get old AND new field values.
New:
- Adding field comparison method
compare_functioninDirtyFieldsMixin.- Also adding a specific comparison function
timezone_support_compareto handle different Datetime situations.
Bugfix:
- Not comparing fields that are deferred (
onlymethod onQuerySet).- Being more tolerant when comparing values that can be on another type than expected.
New:
- Adding
save_dirty_fieldsmethod to save only dirty fields in the database.
New:
- Using
copyto properly track dirty fields on complex fields.- Using
py.testfor tests launching.
Bugfix:
- Preventing django db expressions to be evaluated when testing dirty fields (#39).
New:
- Using
to_pythonto avoid false positives when dealing with model fields that internally convert values (#4)
Bugfix:
- Using
attnameinstead ofnameon fields to avoid massive useless queries on ForeignKey fields (#34). For this kind of field,get_dirty_fields()is now returning instance id, instead of instance itself.
New:
- Adding code compatibility for python3,
- Launching travis-ci tests on python3,
- Using
toxto launch tests on Django 1.5, 1.6, 1.7 and 1.8 versions,- Updating
runtests.pytest script to run properly on every Django version.
Bugfix:
- Catching
Errorwhen trying to get foreign key object if not existing (#32).
Bugfix:
- Removing
model_to_formto avoid bug when using models that haveeditable=Falsefields.
New:
- Adding
check_relationshipparameter onis_dirtyandget_dirty_fieldmethods to also check foreign key values.