FieldInstanceTracker.changed should support exclusion lists
lociii opened this issue · 0 comments
Problem
I'm using a custom base model quite often that automatically sets a certain field in it's overridden save method. Using FieldTracker().changed()
will then obviously return this field as changed.
To make my life easier excluding such an automatic change, I'd like to introduce exclude lists to FieldInstanceTracker.changed
.
Signature would change from
def changed(self):
to
def changed(self, exclude: list = None) -> dict:
so that it will be fully backwards compatible.
exclude
should be a list of field names that will be omitted when generating the result dict.
If you think that this will be a suitable addition to the library, then I'd be happy to provide a pull request.
Just one open question: Would you like the tests to be synthetic one just for FieldInstanceTracker.changed
or extend FieldTrackerTests
etc. accordingly with a assertChangedExcludes
test every time an assertChanged
test happens right now?