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/>
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---