def get_changes_between_models(model1, model2, excludes=None):
 if (excludes is None):
  excludes = []
 changes = {}
 for field in model1._meta.fields:
  if (isinstance(field, (fields.AutoField, fields.related.RelatedField)) or (field.name in excludes)):
   continue
  if (field.value_from_object(model1) != field.value_from_object(model2)):
   changes[field.verbose_name] = (field.value_from_object(model1), field.value_from_object(model2))
 return changes

def get_changes_between_models ( model1 , model2 , excludes = None ) : if ( excludes is None ) : excludes = [ ] changes = { } for field in model1 . _meta . fields : if ( isinstance ( field , ( fields . AutoField , fields . related . RelatedField ) ) or ( field . name in excludes ) ) : continue if ( field . value_from_object ( model1 ) != field . value_from_object ( model2 ) ) : changes [ field . verbose_name ] = ( field . value_from_object ( model1 ) , field . value_from_object ( model2 ) ) return changes
return a dict of differences between two model instances .