Commit deb1c246 authored by Frank Bessou's avatar Frank Bessou 🕸

feat: add attribute constraints to Museum and City

parent 7e2fc86cbc10
Pipeline #39579 passed with stage
in 1 minute and 12 seconds
......@@ -17,20 +17,26 @@
"""cubicweb-tuto schema"""
from yams.buildobjs import EntityType, String, Float, SubjectRelation, Int
from yams.constraints import BoundaryConstraint
class Museum(EntityType):
name = String()
latitude = Float()
longitude = Float()
name = String(required=True)
latitude = Float(
constraints=[BoundaryConstraint(">=", -90), BoundaryConstraint("<=", 90)]
)
longitude = Float(
constraints=[BoundaryConstraint(">=", -180), BoundaryConstraint("<=", 180)]
)
is_in = SubjectRelation("City", cardinality="1*")
director = SubjectRelation("Person", cardinality="**")
postal_address = String()
class City(EntityType):
name = String()
name = String(required=True)
zip_code = Int()
country = String(default="France")
class Person(EntityType):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment