跟踪对Django Model实例的更改 [英] Tracking changes to Django Model instances
问题描述
当您在Django的管理员中创建或修改对象实例时,将创建一个更改日志条目。这是非常好的,因为相当明显的原因。
When you create or modify an object instance in Django's admin, a changelog entry is created. This is really nice for fairly obvious reasons.
但是,我的模型的实例由管理界面之外的普通用户创建。没有记录更改日志来记录其创建(不是一个巨大的问题),但我想跟踪用户所做的编辑。
However my model's instances created by a normal user outside of the admin interface. No changelog is recorded to note its creation (not a huge issue) but I would like to track edits the user makes.
我还想向用户显示这个完整的日志(用户+管理员编辑)在前端,所以我需要一个方法拉出更改日志。
I also want to show the user this full log (user+admin edits) in the frontend so I need a way to pull the changelog out.
我的问题:如何?是否有单行开关可以轻松启用完整的日志记录,或者我必须在我的用户编辑表单逻辑上进行某些操作?
My question: how? Is there a one-line switch I can flick to enable full logging or do I have to dig in and do something on my user's edit form logic?
推荐答案
django-reversion 是一个旨在帮助您的应用程序。
django-reversion is an app designed to help with that.
这篇关于跟踪对Django Model实例的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!