You could do:

def register_dog():
    if request.args(0) == 'edit':
        db.dog.sire_id.requires = IS_IN_DB(db(db.dog.id!
=request.args(2)), db.dog, db.dog._format)
    form=SQLFORM.grid(db.dog, csv=False, paginate=5,
user_signature=False)
    return dict(form=form)

On Feb 5, 4:23 am, Mark Kirkwood <mark.kirkw...@gmail.com> wrote:
> Ok figured out what was causing that - I had one record with '0' for a
> sire_id and no dog with id = 0. Fixing that up makes the representation
> code below work. Yay! *But*... now the edit drop down list is showing
> id's instead of names... scratches head I'm sure that *was* working
> before....
>
> I even redid the example from scratch and...still seeing id's instead of
> names in edit mode. Blast need to try again tomorrow and see if I can
> sort that.  Well at least figured out one of the problems!
>
> On 05/02/12 15:51, Mark Kirkwood wrote:
>
>
>
>
>
>
>
>
>
> > However that brings back a header 'dog.name' that mucks up the
> > appearance of the form. What I wanted to write was:
>
> > db.dog.sire_id.represent = lambda sire_id, row: db.dog(sire_id).name
> > if sire_id != None else None
>
> > However that produces:
>
> > AttributeError: 'NoneType' object has no attribute 'name'
>
> > Which stumps me I must say, since I can clearly see a 'name:' entry
> > displayed if I just leave off the '.name' in the code above...

Reply via email to