Thanks for all your help. As you can see I am having understanding the commands although I can understand some sql and older python. Again thanks, Jim
On Sep 29, 9:22 am, "mr.freeze" <[email protected]> wrote: > Try this then: > > {{for person in db().select(db.person.ALL):}} > <h3>{{=person.first_name}} {{=person.last_name}}</h3> > {{for event in person.events.select():}} > {{=event.description}}<br /> > {{pass}} > {{pass}} > > Beyond that, I would check your data in the db through appadmin and > verify that it is correct. > > On Sep 29, 12:05 am, jayvandal <[email protected]> wrote: > > > Hi again, > > Your example worked for me so I added the pep line to get the person > > and then to show the events, I get all the events for every person. as > > this shows > > ================================================================ > > [Rockefelter] Born big house Birth 2nd House [Clinton] Born big house > > Birth 2nd House [Jack] Born big house Birth 2nd House [smiley] Born > > big house Birth 2nd House [Smiley] Born big house Birth 2nd House > > [Copone] Born big house Birth 2nd House [Smiley] Born big house Birth > > 2nd House > > ==================================================================================== > > Only two people should have events, 3 for Smiley and 1 for Capone. > > Since you have been so kindto help me I hope I can prevail on you to > > explain theway to code this. > > Thanks > > Jim > > On Sep 28, 7:49 pm, "mr.freeze" <[email protected]> wrote: > > > > This works for me: > > > > def index(): > > > rows = db(db.events.person==db.person.id).select() > > > return dict(rows=rows) > > > > {{for row in rows:}} > > > {{=row.events.description}} : {{=row.person.first_name}} > > > {{=row.person.last_name}} > > > {{pass}} > > > > On Sep 28, 7:44 pm, jayvandal <[email protected]> wrote: > > > > > I tried your suggestion. > > > > Here is the events table. Thanks for your help. I am at a loss > > > > Jim > > > > ==================================================================== > > > > db.define_table('events', > > > > Field('person',db.person), > > > > Field('description',length=128), > > > > Field('category',db.category), > > > > Field('contact',db.person), > > > > Field('start_date',length=10, > > > > comment='Example ex: 1975-09-20'), > > > > Field('end_date',length=10, > > > > comment='Example ex: 1975-09-20'), > > > > Field('address',length=128), > > > > Field('city',length=128), > > > > Field('states',db.states), > > > > Field('country',length=128), > > > > Field('zipcode',length=9), > > > > Field('amount','integer',default=0.0)) > > > > db.events.contact.requires=IS_IN_DB(db,'person.id','%(first_name)s % > > > > (last_name)s') > > > > db.events.person.requires=IS_IN_DB(db,'person.id','%(first_name)s % > > > > (last_name)s') > > > > db.events.states.requires=IS_IN_DB(db,'states.id','states.state_name') > > > > db.events.category.requires=IS_IN_DB > > > > (db,'category.id','category.category_name') > > > > db.events.amount.requires=IS_FLOAT_IN_RANGE(0,10000) > > > > > ======================================================================== > > > > On Sep 28, 5:17 pm, "mr.freeze" <[email protected]> wrote: > > > > > > I would really need to see your model to be sure but try: > > > > > ev=db(db.events.person==db.person.id).select() > > > > > for row in ev: > > > > > print row.events.description, row.person.name > > > > > > On Sep 28, 5:51 pm, jayvandal <[email protected]> wrote: > > > > > > > I changed to your suggestion and I get an error it can't find the > > > > > > word > > > > > > 'description' > > > > > > No matter what I try , I can put the word in quotes and it prints > > > > > > out > > > > > > the appropiate times . > > > > > > When I run ipython ev=db(db.events.person==db.person.id).select > > > > > > ('person','description') > > > > > > then print ev I get the values of the description > > > > > > The code I have looks similar to the examples I see. > > > > > > Any suggestions???? > > > > > > Thanks > > > > > > Jim > > > > > > > On Sep 28, 12:10 pm, "mr.freeze" <[email protected]> wrote: > > > > > > > > I think you need to change this: > > > > > > > {{for events in events:}} > > > > > > > ... > > > > > > > <td>{{=description}}</td> > > > > > > > > ...to this...: > > > > > > > {{for event in events:}} > > > > > > > ... > > > > > > > <td>{{=event.description}}</td> > > > > > > > > On Sep 28, 12:46 pm, jayvandal <[email protected]> wrote: > > > > > > > > > Hi again > > > > > > > > I can't understand why I can't(two can't) display a field in my > > > > > > > > project. When I run the controller statements in ipython and I > > > > > > > > print > > > > > > > > the results I can see the data in the description field. Yet in > > > > > > > > my > > > > > > > > view code I get an error., description > > > > > > > > Here is the code. > > > > > > > > Any help is appreciated > > > > > > > > ====================================================== > > > > > > > > def person_events(): > > > > > > > > pep=db(db.person.id> 0).select(orderby=db.person.id) > > > > > > > > form=SQLFORM(db.events,fields=['end_date']) > > > > > > > > events=db(db.events.person==db.person.id).select > > > > > > > > ('person','description') > > > > > > > > return dict(pep=pep,events=events,form=form) > > > > > > > > > ======================================================== > > > > > > > > {{extend 'layout.html'}} > > > > > > > > > <h2>Person and Events:</h2> > > > > > > > > > {{=form}} > > > > > > > > > {{for person in pep:}} > > > > > > > > [{{=A(person.last_name,_href=URL(r=request,f='person/ > > > > > > > > %s'%person.id))}}] > > > > > > > > > <br/><br/> > > > > > > > > <h1>Featured Events</h1> > > > > > > > > <p><center><table width="80%"> > > > > > > > > {{if len(events):}} > > > > > > > > > {{for events in events:}} > > > > > > > > <tr> > > > > > > > > > <td>{{=description}}</td> > > > > > > > > > </tr> > > > > > > > > {{pass}} > > > > > > > > {{else:}} > > > > > > > > <h2> no events</h2> > > > > > > > > > {{pass}} > > > > > > > > > {{pass}} > > > > > > > > </table></center></p><br/><br/>- Hide quoted text - > > > - Show quoted text - > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

