Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented CRUD_EVENT_NO_CHANGED_FIELDS_SKIP #249

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion easyaudit/signals/model_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from easyaudit.models import CRUDEvent
from easyaudit.settings import REGISTERED_CLASSES, UNREGISTERED_CLASSES, \
WATCH_MODEL_EVENTS, CRUD_DIFFERENCE_CALLBACKS, LOGGING_BACKEND, \
DATABASE_ALIAS
DATABASE_ALIAS, CRUD_EVENT_NO_CHANGED_FIELDS_SKIP
from easyaudit.utils import get_m2m_field_name, model_delta

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -73,6 +73,9 @@ def pre_save(sender, instance, raw, using, update_fields, **kwargs):
try:
if not should_audit(instance):
return False

if CRUD_EVENT_NO_CHANGED_FIELDS_SKIP:
return

with transaction.atomic(using=using):
try:
Expand Down