if you use

db.blog.tags.requires = IS_IN_DB(db, 'tags.id',
'tags.name',multiple=True)

than you are not using many2many but you are denormalizing. that means
db.blogs.tags has to be a string field and tags will be stored as '|3|
6|18|43|'.  So:

db.define_table ('blog',
    Field('heading'),
    Field('description' ,'text'),
    Field('tags') # not Field('tags',db.tag)
  )

Massimo

On Jul 29, 12:24 pm, Abhiteja <[email protected]> wrote:
> Hi Gurus,
>
> I want to map multiple tags to a blog and allow users to select
> predefined tags to a blog header.
> I am able to see form for blogs and no errors shown after submit , but
> nothing is entered to DB.
>
> Am I missing something, please help me out.
>
> Thanks & regards
>
> Abhiteja
>
> PS: My setup info
> ------------- I have following db definition: --------------
>
> db.define_table('tags',
>    Field('name')
>   )
>
> db.define_table ('blog',
>     Field('heading'),
>     Field('description' ,'text'),
>     Field('tags', db.tags)
>   )
>
> db.blogs.tags.requires = IS_IN_DB(db, 'tags.id', 'tags.name',
> multiple=True)
>
> ----------- Here is the controller definition for blogs: ----------
> def blogs():
>
>     form = SQLFORM(db.blogs)
>
> #    if form.accepts(request.vars, session):
> #        response.flash = 'new song addded'
>
>     records = SQLTABLE(db().select(db.blogs.ALL))
>     return dict(form=form, records=records)

Reply via email to