yes use tag.name instead of tag.id in IS_IN_DB(...)
On Aug 1, 5:59 am, Abhiteja <[email protected]> wrote: > hi Gurus, > > Thanks for your help, I was able to run the program successfully. > > After following the suggestions, I have following issue: > > Blogs table contents: > blogs.id blogs.heading blogs.description > blog.tags > 1 h1 > d1 |1|3| > > tags table contents: > tags.id tags.name > 1 t1 > 2 t2 > 3 t3 > > I want Blog-table to show blogs.tags as '|t1|t3|' -- not as '|1|3|'. > > I am not sure how/where to-apply the tag.name with some thing like: > '(name)s' to get the tag.name instead of tag.id > > thanks in advance > > Abhiteja > > On Jul 29, 10: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)

