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

Ignore null changeset on creation and deletion #282

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

joeyjoejoejr
Copy link

Problem

I registered a nullable field of a model using include_fields. There was a a check for null changes in the log_update receiver, but not the log_create and log_delete ones. This meant that a log entry was created with null for the changes field whenever a model was created or updated, but didn't have a value for that field.

When the mixin method msg_short is called in the Audit Log admin index, it would error because it's expecting an object for changes.

What Changed:

  • Made the SimpleIncludeModel label field nullable
  • Added tests for creation and deletion of a model with a null label field
  • Added checks to log_create and log_delete to make sure entries aren't created if the changes are None.

@codecov
Copy link

codecov bot commented Nov 10, 2020

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.02%. Comparing base (31418d5) to head (3aaada0).
Report is 242 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #282      +/-   ##
==========================================
- Coverage   82.20%   82.02%   -0.19%     
==========================================
  Files          18       18              
  Lines         489      495       +6     
==========================================
+ Hits          402      406       +4     
- Misses         87       89       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hramezani
Copy link
Member

Thanks @joeyjoejoejr for the patch 👍
Could you please rebase your patch?

@demmojo demmojo linked an issue Jul 29, 2022 that may be closed by this pull request
@aqeelat
Copy link
Member

aqeelat commented Dec 22, 2022

@hramezani I think will be solved as a side-effect of #483. We might still need the tests but let's evaluate after we merge #483.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants