Add
  format='%(name)s'
to the end of your categories table definition.

BTW, you should also change
  request.args[0]
to
  request.args(0)
to avoid error tickets when no args are present.


On Apr 13, 9:43 am, rixder <[email protected]> wrote:
> Hi,
> I can't find solution..:
> I have in model:
> db.define_table('categories',
>         Field('name', 'string', length=512,
> requires=(IS_SLUG())),
>         Field('title', 'string', length=512, required=True),
>         Field('description', 'text',
> default=""),
>         Field('created_on', 'datetime',
> default=datetime.datetime.today()))
>
> db.define_table('articles',
>         Field('name', 'string', length=255,
> default="",requires=(IS_SLUG())),
>         Field('title', required=True, requires=IS_NOT_IN_DB(db,
> 'articles.title')),
>         Field('summary', 'text'),
>         Field('body', 'text'),
>         Field('categories', 'list:reference categories'),
>         Field('created_on', 'datetime',
> default=datetime.datetime.today()),
>         Field('is_page', 'boolean'))
>
> In controler:
>
> def edit():
>     table, record = request.args[0], request.args[1]
>     form=SQLFORM(db[table], record)
>     return dict(form=form)
>
> It works, but if I edit articles record I want to display categories
> names in field articles.categories instead of categories.id's . Is any
> simply way to do it?
>
> Best Regards,
> Pawel

Reply via email to