that did it. That was simpler than what I thought. Thanks
d On May 19, 10:32 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > I think you want to replace > > form=crud.create(db.project_location) > > with > > location = > db(db.project_location.project==project_id).select().first() > form=crud.update(db.project_location,location) > > if location is None, crud.update defaults to crud.create > > On May 19, 8:57 am, greenpoise <danel.sega...@gmail.com> wrote: > > > Hi there. I am a bit stuck here. ANy help greatly appreciated. I have > > this: > > > @auth.requires_login() > > def crear_project_location(): > > project_id=request.args(0) > > project=db.project[project_id] > > > if project: > > db.project_location.project.default=project_id > > db.project_location.project.writable=False > > form=crud.create(db.project_location) > > > projects=db(db.project_location.project==project.id).select(orderby=db.project_location.project) > > > else: > > form=None > > > projects=db(db.project_location.id>0).select(orderby=db.project_location.name) > > return dict(project=project,projects=projects,form=form) > > > It works perfect BUT it will always get me to a blank editable form > > due to the crud.create. I tried putting a crud.read. I want the user > > to click on the link and if there is already a project _location for a > > project then just display it (crud.read), if the project has no > > location associated, then it will give me crud.write. I know it must > > be simple but I cant figure it out. > > > THanks