开发者

discovering which admin performed an action in Django

开发者 https://www.devze.com 2023-04-05 16:26 出处:网络
I am trying to set up a system where every time something happens in the admin console (let\'s say, a user is saved), a certain set of people gets notified.I hooked up post_save and

I am trying to set up a system where every time something happens in the admin console (let's say, a user is saved), a certain set of people gets notified. I hooked up post_save and it works fine. I can retrieve most of the data I need (which user and what fields were saved) from the instance passed into the callback function. However, there's one thing in the requirements, which I can't figure out how to do and that is to show, which particular admin made th开发者_如何学JAVAe change. Any ideas on how that can be done?

Thank you, Luka


If you go through the database, you will discover that you have the table django_admin_log which lists what changes were made by what admin and even has a change_message . Maybe you can create a view for this table and play around with the queries.

0

精彩评论

暂无评论...
验证码 换一张
取 消