Fixed ignored new fields when showing/detecting a model change

This commit is contained in:
Bruno Tournay 2014-02-28 23:36:47 +01:00
parent 86bf8b65ba
commit 8b35ec9d95

View file

@ -599,9 +599,9 @@ def show_model_changes(new, old=None, fields=None, always=False):
"""
old = old or new._db._get(type(new), new.id)
# Build up lines showing changes.
# Build up lines showing changed or new fields.
changes = []
for field in old:
for field in old.keys() + list(set(new.keys()) - set(old.keys())):
# Subset of the fields. Never show mtime.
if field == 'mtime' or (fields and field not in fields):
continue