doc/book/en/devrepo/datamodel/definition.rst
changeset 10301 729f36a1bcfa
parent 10222 75d6096216d7
parent 10281 cc9eb88377f4
--- a/doc/book/en/devrepo/datamodel/definition.rst	Wed Mar 25 10:10:24 2015 +0100
+++ b/doc/book/en/devrepo/datamodel/definition.rst	Wed Apr 22 10:08:14 2015 +0200
@@ -244,8 +244,14 @@
 
 .. sourcecode:: python
 
-   from yams.constraints import BoundaryConstraint, TODAY
-   BoundaryConstraint('<=', TODAY())
+   from yams.constraints import BoundaryConstraint, TODAY, NOW, Attribute
+
+   class DatedEntity(EntityType):
+      start = Date(constraints=[BoundaryConstraint('>=', TODAY())])
+      end = Date(constraints=[BoundaryConstraint('>=', Attribute('start'))])
+
+   class Before(EntityType);
+      last_time = DateTime(constraints=[BoundaryConstraint('<=', NOW())])
 
 * `IntervalBoundConstraint`: allows to specify an interval with
   included values
@@ -259,7 +265,12 @@
 
 * `StaticVocabularyConstraint`: identical to "vocabulary=(...)"
 
-.. XXX Attribute, NOW
+Constraints can be dependent on a fixed value (90, Date(2015,3,23)) or a variable.
+In this second case, yams can handle :
+
+* `Attribute`: compare to the value of another attribute.
+* `TODAY`: compare to the current Date.
+* `NOW`: compare to the current Datetime.
 
 RQL Based Constraints
 ......................