I have a database model that is being updated based on changes in remote data (via an HTML scraper).
I want to maintain a field called changed
- a timestamp denoting when the last time that model's values changed from what they were previously (note that this is different from auto_now
as these fields are updated every time a model's save
method is called).
Here is my question:
In a model's save
method, is there a straightforward way to detect if a model instance's current values are different from the values in the database? Or, are there any alternative methods to easily maintain a changed
timestamp?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…