Hi, the follow model is rigth to crud:

db.define_table('category',iObj,
    Field('parent','reference category'),
    Field('name'),
    format='%(name)s')
db.category.parent.requires =  IS_EMPTY_OR(IS_IN_DB(db,
db.category.id, '%(name)s'))
db.category.name.requires = IS_NOT_IN_DB(db, db.category.name)


No need of a custom crud.

On 12 jan, 18:53, SaltyCow <jeff.bienkow...@gmail.com> wrote:
> Hello there...
>
> I'm hoping that this is a common problem with a simple solution.
>
> I'm attempting to create an app that uses self-referencing tables, in
> one case to refer to employees and their managers (who themselves are
> also employees). I used the app wizard to generate the scaffolding. I
> am able to add records, but the boilerplate crud read and crud select
> functions return the following error: Using a recursive select, but
> encountered a broken reference. Also, the form generated by the crud
> create function does not generate a drop-down selection box as it
> normally would for a reference field.
>
> So, my question is, really, do I need to write custom crud functions
> to work with self-referencing tables and, if so, does anyone know the
> best way to do this? I've read the part in the docs about using
> "with_alias" but I can't seem to make heads or tails of it. (Not a
> problem with the manual, just my limited knowledge of SQL.)
>
> I'd appreciate any further direction anyone can give me.
>
> Thanks...>Jeff

Reply via email to