- Fix get_diff utility. Thanks, @ahumeau!
- Upgrade python syntax to Python 3.8
- Remove pre-django 4.2 code
- Remove unused imports
- Fix Python and Django supported versions in docs and Pypi
- Add a context manager to bypass hooks. Thanks, @ticosax!
- Add support for django 6.0. Thanks @scpaes and @kimihito!
- Remove support for unsupported versions of Django and Python.
- Avoid evaluating attributes. Thanks, @TonisPiip!
- Format code with ruff (and automate it with pre-commit)
- Revert deepcopying model state to copy
- Update the initial state after calling
refresh_from_dbon the model instance. Thanks, @partizaans! - Refactor: Extract model state methods
- Fix imports
- Fix pypi release by explicitly include
conditionsfolder
- Fix import errors
- Hook condition can be now built using some predefined conditions and/or with custom ones.
- Fix
has_changedandchanged_towhen working with mutable data (i.e.:dicts). Thanks @AlaaNour94
- Fix: Hooks were failing if some watched field (those in
when=""orwhen_any=[...]) was aGenericForeignKey
- Fix: Include missing
django_lifecycle_checksinto python package
- Drop support for Django < 2.2.
- Confirm support for Django 5.0. Thanks @adamchainz!
- Remove urlman from required packages. Thanks @DmytroLitvinov!
- Add an optional Django check to avoid errors by not inheriting from
LifecycleModelMixin(orLifecycleModel)
- Correct package info to note that Django 4.0, 4.1, and 4.2 are supported.
- Initial state gets reset using
transaction.on_commit(), fixing thehas_changed()andinitial_value()methods for on_commit hooks. Thanks @alb3rto269!
- Drops Python 3.6 support
- Adds
priorityhook kwarg to control the order in which hooked methods fire. Thanks @EnriqueSoria! - Internal cleanup/refactoring. Thanks @EnriqueSoria!
- Adds missing
packagingtoinstall_requires. Thanks @mikedep333!
- Makes the
has_changed,changes_toconditions depend on whether the field in question was included in the SQL update/insert statement by checking theupdate_fieldsargument passed to save.
- Adds optional @hook
on_commitargument for executing hooks when the database transaction is committed. Thanks @amcclosky!
- Correct packge info to note that Django 3.2 is supported.
- Run hooked methods inside transactions, just as signals do. Thanks @amirmotlagh!
- Makes hooks work with OneToOneFields. Thanks @bahmdev!
- Prevents calling a hooked method twice with the same state. Thanks @garyd203!
- Added missing return to
delete()method override. Thanks @oaosman84!
- Significant performance improvements. Thanks @dralley!
- Fixes issue with
GenericForeignKey. Thanks @bmbouter!
- Updates to use constants for hook names; updates docs to indicate Python 3.8/Django 3.x support. Thanks @thejoeejoee!
- Adds static typed variables for hook names; thanks @Faisal-Manzer!
- Fixes some typos in docs; thanks @tomdyson and @bmispelon!
- Fixes bug in
utils._get_field_namesthat could cause recursion bug in some cases.
- Adds
changes_tocondition - thanks @samitnuk! Also some typo fixes in docs.
- Remove variable type annotation for Python 3.5 compatability.
- Adds
when_anyhook parameter to watch multiple fields for state changes
- Adds
was_notcondition - Allow watching changes to FK model field values, not just FK references
- Fixes missing README.md issue that broke install.
- Fixes urlman-compatability.
- Fixes
initial_value(field_name)behavior - should return value even if no change. Thanks @adamJLev!
- Fixes bug preventing hooks from firing for custom PKs. Thanks @atugushev!
- Fixes m2m field bug, in which accessing auto-generated reverse field in
before_createcauses exception b/c PK does not exist yet. Thanks @garyd203!
- Resets model's comparison state for hook conditions after
savecalled.
- Fixed support for adding multiple
@hookdecorators to same method.
- Removes residual mixin methods from earlier implementation.
- Save method now accepts
skip_hooks, an optional boolean keyword argument that controls whether hooked methods are called.
- Fixed bug in
_potentially_hooked_methodsthat caused unwanted side effects by accessing model instance methods decorated with@cache_propertyor@property.
- Added Django 1.8 support. Thanks @jtiai!
- Tox testing added for Python 3.4, 3.5, 3.6 and Django 1.8, 1.11 and 2.0. Thanks @jtiai!