Hi all,
Working through the official documentation on Chapter 3, on Image blog
example.
in models.db.py
db.define_table('image', ...)
db.define_table('post', ...)
...
db.post.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
in controllers/default.py
def show():
image = db.image(request.args(0,cast=int)) or redirect(URL('index'))
db.post.image_id.default = image.id # <--- this line
...
I tried removing the line (db.post.image_id.default = image.id), and used
the non-admin page to insert comments. The comments are inserted into DB.
On admin page, post.image_id of those comments would show as None. This is
somewhat surprising to me as I thought they were enforcing referencial
integrity at DB level. It seems the validatiors are merely for front-end
validation at form level. Is that correct? If so, does web2py have a way to
enforce DB level validation?
Thanks,
Dan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.