With the query I suggest yesterday, I don't think he need is_active. For sure if this field is not update to true when assign a dog a new trainer, they (trainers) will never be active so they will be in the dropbox for ever.
Richard On Tue, Aug 28, 2012 at 6:27 AM, villas <[email protected]> wrote: > 1. Did you try pasting my code exactly as I wrote it? If you are hesitant > about overwriting your existing work, then simply rename, within my code, > the dogs and trainers to something like cats and groomers and try it > totally independently of everything else you have done. > > 2. I have ignored your use of is_active because I did not understand how > that was being used? Are you sure you need that? How are you setting that > field? > > Regards, D > > > On Tuesday, August 28, 2012 4:36:22 AM UTC+1, Bill Thayer wrote: >> >> model >> db.define_table('trainer', >> Field('name'), >> Field('specialty'), >> auth.signature, >> >> format='%(name)s', >> migrate=True, >> >> ) >> db.trainer.is_active.default=F**alse >> >> db.define_table('dogs', >> Field('name'), >> Field('bites', 'boolean'), >> >> Field('trainer', 'reference trainer', default=1), >> auth.signature, >> format='%(name)s', >> migrate=True, >> ) >> >> >> >> >> controller >> def assign_trainers(): >> db.dogs.trainer.requires = IS_IN_DB(db(db.trainer.is_**active==False >> ), >> 'trainer.id', '%(name)s',zero=T('choose one')) >> >> search='trainer equal 1 or trainer equal 0' >> #1 is the default value of a trainer named "Unassigned" >> rows = db.smart_query([db.dogs], search).select() >> grid = SQLFORM.smartgrid(db.dogs) >> >> return locals() >> >> view >> {{extend 'layout.html'}} >> <h2>Assign Trainers</h2> >> <p>page used as an example posted to user group for help >> {{=grid}} >> {{=rows}} >> >> >> The rows are what I want from the dogs thanks to smart_query() but they >> are not in the "smart"grid. >> >> The "smart"grid shows all the dogs but will not take rows as a paramter. >> >> Click on the edit button and the edit page drop downs now only shows >> trainers who's in_active field == False. >> >> So I'm getting closer to my goal of making one grid with drop downs to >> assign new trainers to new unassigned dogs. >> >> my_need_for_help.is_active=Tru**e #still >> >> -Bill >> >> >> >> -- > > > > --

