So I have my table (as seen below) and I want to make it display in the
view below but I don't want it to show all the records, just the records
with the same 'auth_user.teacher_id' as the currently logged in user. How
would I do this?
My Controller:
def default_obs():
obs = db().select(db.observation.teacher_id,db.observation.date,orderby
=db.observation.date)
return dict(obs=obs)
My View:
{{extend 'layout.html'}}
<h1>Available wiki pages</h1>
[ {{=A('search', _href=URL('search'))}} ]<br />
<ul>{{for observation in obs:}}
{{=LI(A(observation.date, _href=URL('show', args=observation.date)))}}
{{pass}}</ul>
My db.py:
auth.settings.extra_fields['auth_user']= [
Field('first_name', type='string'),
Field('last_name', type='string'),
Field('department', type='string'),
Field('date_joined_school', type='date')]
auth.define_tables(username=True,)
auth.settings.everybody_group_id = 7
auth.messages.label_remember_me = "Remember Me "
db.define_table('observation',
Field('teacher_id', 'reference auth_user' ),
Field('observer', type='string'),
Field('subject'),
Field('class_name', type='string'),
Field('year_group', type='string'),
Field('outcome',),
Field('details', type='string'),
Field('date', type='date'),
Field('extra_information', 'upload'))
Thank you very much for your help
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.