Tracking changes to Django Model instances

谁都会走 提交于 2020-07-15 00:57:26

问题


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?


回答1:


django-reversion is an app designed to help with that.



来源:https://stackoverflow.com/questions/2334503/tracking-changes-to-django-model-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!