HI,
I have this table, controller, and view. I am trying to list all
persons and their events. I can't seem to get the description field to
display as the events for the person.
When I run this " ev=db(db.events.person==db.person.id).select() "  I
see all the tables and description , yet when I run my code it can't
find the "description" field data.
Any help  Thanks,
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)
=====================================================
def person_events():
  pep=db(db.person.id> 0).select(orderby=db.person.id)
  form=SQLFORM(db.events,fields=['description'])
  ev=db(db.events.person==db.person.id).select()
#  form= SQLFORM(event,fields=['description'])
  return dict(pep=pep,ev=ev,form=form)
=======================================================
{{extend 'layout.html'}}


<h2>Person and Events:</h2>
<h2>
{{for person in pep:}}
[{{=A(person.last_name,_href=URL(r=request,f='person/
%s'%person.id))}}]

</h2><br/><br/>

<h1>Featured Events</h1>
<p><center><table width="80%">
{{if len(ev):}}
<tr>
{{for ev in ev:}}


<td>
<p>{{=ev.description}}</p>
</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
-~----------~----~----~----~------~----~------~--~---

Reply via email to