How can I add validation to my models? I tried to use @before_insert and
@before_update as follows, but it didn't work as I expected.
class Link(Entity):
url = Field(Unicode)
...
@before_insert
@before_update
def validate(self):
if not is_valid_url(self.url):
return False
return True
But it seems the object is saved regardless of the return value. How is
this normally accomplished?
--
You received this message because you are subscribed to the Google Groups
"SQLElixir" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlelixir?hl=en.