-
Notifications
You must be signed in to change notification settings - Fork 402
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
[question] Changes to only track field that changed #552
Comments
aabanaag
changed the title
Changes to only track field that changed
[question] Changes to only track field that changed
Aug 9, 2023
you can probably add this to your model class MyModel(models.Model):
__audit_log_change_reason: str = ""
@property
def audit_log_change_reason(self) -> str:
return self.__audit_log_change_reason
@audit_log_change_reason.setter
def audit_log_change_reason(self, value: str) -> None:
self.__audit_log_change_reason = value
def get_additional_data(self):
data = {}
if self.audit_log_change_reason:
data["change_reason"] = self.audit_log_change_reason
return data and then create a pre_save signal for your model to populate the field. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So I have a specific requirement where I have categories of changes, and I don't have use for the values that changed but only with the fields that changed. Is it possible to modify it by handling it via pre_log? (i.e changes: ['requirements, 'details'])
The text was updated successfully, but these errors were encountered: