Created
April 1, 2023 16:48
-
-
Save victory-sokolov/5485f0bbb7f58da5ad5a8bec3ee4b18a to your computer and use it in GitHub Desktop.
Django admin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add Logging to specific data | |
from django.contrib.admin.models import CHANGE, LogEntry | |
from django.contrib.contenttypes.models import ContentType | |
LogEntry.objects.log_action( | |
user_id=request.user.id, | |
content_type_id=ContentType.objects.get_for_model(self.model).pk, | |
object_id=object_id, | |
object_repr=object_id, | |
change_message=message, | |
action_flag=CHANGE, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment