-
Notifications
You must be signed in to change notification settings - Fork 413
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
Skip stringify if json #355
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I let you some comments.
Hi @Linkid, can you give the PR another check? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Sorry about that, but with the PR #370, django-jsonfield-backport
is removed. Then, you can use this line instead:
from django.db.models import JSONField
Sounds good to me. Thanks for the review @Linkid. When are you planning to make a release, though? Thanks a lot! |
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #355 +/- ##
==========================================
+ Coverage 82.64% 83.39% +0.75%
==========================================
Files 20 20
Lines 507 506 -1
==========================================
+ Hits 419 422 +3
+ Misses 88 84 -4
Continue to review full report at Codecov.
|
* master: Remove default_app_config configuration Fix lint entry in tox.ini Drop Django 2.2 support. [pre-commit.ci] pre-commit autoupdate Fix small typo Add mask_fields argument in register (jazzband#310) Use pre-commit as lint command Add black and isort to .pre-commit-config.yaml Replace assertTrue with assertEqual enable use of replica database (jazzband#359)
Thanks @barrachri for the patch. Please:
|
* master: Prepare release of django-auditlog 2.0.0 Update postgres image version in github action test workflow Fix typo in CHANGELOG.md
Thanks @hramezani. Do you think the added tests are enough? |
Thanks @barrachri for the tests. But I can see your tests are passing without the fix. Also, Please add a changelog entry. |
Hi @hramezani you can try to run it again, while disabling the I also added the changelog entry. |
Co-authored-by: Hasan Ramezani <[email protected]>
Co-authored-by: Hasan Ramezani <[email protected]>
auditlog/diff.py
Outdated
elif isinstance(field, JSONField): | ||
try: | ||
value = field.to_python(getattr(obj, field.name, None)) | ||
except ObjectDoesNotExist: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a test that covers this except
block 🤔 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no test, in general, that covers the except ObjectDoesNotExist:
part of get_field_value.
I am happy to add one though not entirely sure how to replicate that directly with the model (I believe we would need a migration to replicate it with save()).
But I can call model_instance_diff directly, with 2 instances and one has the attribute deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, it is a blocker because coverage fails and I can't merge the PR
…into fix-jsonfield * 'fix-jsonfield' of github.com:barrachri/django-auditlog: Update CHANGELOG.md Update CHANGELOG.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @barrachri 👍
Thanks @hramezani, I added a new test and refactored the ObjectDoesNotExist try/except. |
Fixes #354