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

Customise the str message in the Changes column. #647

Open
richdevelopments opened this issue May 24, 2024 · 0 comments
Open

Customise the str message in the Changes column. #647

richdevelopments opened this issue May 24, 2024 · 0 comments

Comments

@richdevelopments
Copy link

richdevelopments commented May 24, 2024

I am using django-auditlog to track the changes with django-waffle switches.
Currently when a switch is activated when the Active checkbox is checked (True) or deactivated when the Active checkbox is unchecked (False), auditlog just displays the field that has been changed, in this case the active field -

Screenshot from 2024-05-24 14-48-54

I am trying to customise this so when the switches Active field has been changed to True auditlog Changes column displays "Changed to Active" and when the switches Active field has been changed to False, auditlog Changes column displays "Changed to Inactive"
Is this possible?

I am trying it out by adding django auditlog to my admin.py and here I can add/take away some columns and also get the value (True/False) of the Changes column for each logged instance for the switches.

Is there a way of updating the change message by doing something like

if latest_switch_change == True:
      Changes text = "Changed to active"
else:
      Changes text = "Changed to inactive" 
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

No branches or pull requests

1 participant