-
Notifications
You must be signed in to change notification settings - Fork 420
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
Add register model using Django settings #368
Add register model using Django settings #368
Conversation
Codecov Report
@@ Coverage Diff @@
## master #368 +/- ##
==========================================
+ Coverage 83.39% 85.66% +2.26%
==========================================
Files 20 21 +1
Lines 506 565 +59
==========================================
+ Hits 422 484 +62
+ Misses 84 81 -3
Continue to review full report at Codecov.
|
097cf56
to
fb38f0c
Compare
Thanks @2ykwang for this patch. Please:
|
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.
Could you add some tests with excluding fields, errors in new config vars and with a batch registration, please? Thanks
@2ykwang Please add a changelog entry. |
@hramezani Done! |
I think you forgot to add documentation |
auditlog_tests/tests.py
Outdated
self.test_auditlog.unregister(model) | ||
|
||
def test_auditlog_register_models(self): | ||
with self.assertRaises(TypeError): |
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.
Let's use assertRaisesMessage to check the error message as well
Please provide the initial version of the documentation and then we can improve it with the help of @Linkid |
68d8f11
to
c4c471b
Compare
auditlog/registry.py
Outdated
include_all_models=False, | ||
include_auto_created=False, |
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.
Why do we have these two args here? Do they need just to make the function easier to test?
@2ykwang Could you please open my access to your fork, I am going to push some changes to your PR |
@hramezani I just invited you. thank you! |
[pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
18615bd
to
8065a11
Compare
@2ykwang I will work on this patch and will update it later when I have time. |
1802fa7
to
cd74ffa
Compare
51f2be6
to
1c28d97
Compare
@2ykwang I've refactored some parts of your patch. Please take look. |
@Linkid It would be great if you have time for a review! |
@hramezani |
This PR makes it easy to register model in the django-auditlog.
Setting variable
AUDITLOG_INCLUDE_ALL_MODELS
-> registers all models loaded from the django instance.
e.g)
AUDITLOG_INCLUDE_TRACKING_MODELS
-> assign models to register. this has the same behavior as
audit log.register()
e.g)
AUDITLOG_EXCLUDE_TRACKING_MODELS
-> assign models to exclude. this option is executed when
AUDITLOG_INCLUDE_ALL_MODELS
value is True.e.g)