Hi guys!
Been looking for this in the mail list but i can't understand why this is
happening.
Here is the model. Very simple, just learning and practicing. Its a version
with a few changes of the image blog :)
db.define_table('uploads',
Field('up_name','string',requires=IS_NOT_EMPTY()),
Field('mainfile','upload'),
Field('thumb','upload',writable=False,readable=False),
Field('up_author',db.auth_user,requires=IS_NOT_EMPTY()),
Field('up_post','reference post'),
format='%(up_name)s')
db.uploads.up_author.writable = db.uploads.up_author.readable = False
db.define_table('post',
Field('category',requires=IS_IN_SET([T('Cat1'),T('Cat2'),T('Cat3'),T('Other')])),
Field('country',requires=IS_IN_SET([T('Argentina'),T('Spain'),T('US'),T('Other')])),
Field('place',requires=IS_NOT_EMPTY()),
Field('summary','string',requires=IS_NOT_EMPTY()),
Field('author',db.auth_user,requires=IS_NOT_EMPTY()),
Field('body','text'),
Field('link1', requires=IS_EMPTY_OR(IS_URL())),
Field('link2',requires=IS_EMPTY_OR(IS_URL())),
Field('link3',requires=IS_EMPTY_OR(IS_URL())),
Field('rel_post','reference post'),
format='%(summary)s')
db.post.rel_post.requires = IS_EMPTY_OR(IS_IN_DB(db,db.post,'%(summary)s'))
db.post.author.writable = db.post.author.readable = False
#db.uploads.up_post.requires = IS_IN_DB(db,db.post,'%(summary)s')
db.uploads.up_post.requires = IS_IN_DB(db(db.post.author == auth.user_id),
db.post,'%(summary)s')
db.define_table('comentarios',
Field('com_post_id','reference post'),
Field('com_comentario','text'),
Field('com_fecha','datetime')
)
I added the table commentaries recently. The image and post tables were
populated ok from a FORM view.
Now i tried to add a comment to an existing post through the dbadmin new
record. The form brought the post ids OK. But when i submit the form i get
the mentioned exception.
I read about disabling FK validation but i dont want to do that.
Thanks for the help as always!
--
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/groups/opt_out.