acid
acid copied to clipboard
Unique index constraints, or validation callbacks
This is from the old TODO list. Uniqueness can already be done using constraints in meta.py:
@acid.meta.constraint
def is_unique(self):
return MyModel.by_some_index.get(self.must_be_unique_value) is None
meta.py also supports triggers, which covers 'collection watches'.
Consider moving the triggers/constraints code down to the Collection class (since meta.py isn't going to be useful in every program).