Ajout django_history_tables
[cyril.git] / Apps / django_history_tables / views.py
1 # Create your views here.
2 from django.db.models import fields
3
4
5 def instance_diff(instA, instB):
6 changes = {}
7
8 for f in instA._meta.fields:
9 if not isinstance(f, (fields.AutoField, fields.related.RelatedField)):
10 if f.value_from_object(instA) != f.value_from_object(instB):
11 changes[f.verbose_name] = (f.value_from_object(instA), \
12 f.value_from_object(instB))
13
14 return changes