コード例 #1
0
def has_changed_condition(instance, property_name, prevent_if=None, **_):
    """Check if instance attribute has changed
     Example:
      "terms": {
         "property_name": "archived"
       },
       "condition": "has_changed"

  """
    if getattr(instance, property_name, False) == prevent_if:
        return True
    return db.inspect(instance).get_history(property_name, False).has_changes()
コード例 #2
0
def has_changed_condition(instance, property_name, prevent_if=None, **_):
  """Check if instance attribute has changed
     Example:
      "terms": {
         "property_name": "archived"
       },
       "condition": "has_changed"

  """
  if getattr(instance, property_name, False) == prevent_if:
    return True
  return db.inspect(instance).get_history(
      property_name, False).has_changes()